Windows command line options

Command MS-DOS Win 98 Win XP Win Vista Win 7 Win 8
Append Y Y Y1 Y1 Y1 Y1
Arp N Y Y Y Y Y
Assoc N N Y Y Y Y
At N N Y Y Y Y
Atmadm N N Y N N N
Attrib Y Y Y Y Y Y
Auditpol N N N Y Y Y
Bcdboot N N N N Y Y
Bcdedit N N N Y Y Y
Bdehdcfg N N N N Y Y
Bitsadmin N N N Y Y Y
Bootcfg N N Y Y Y Y
Bootsect N N N Y10 Y10 Y
Break Y Y Y Y Y Y
Cacls N N Y Y Y Y
Call Y Y Y Y Y Y
Cd Y Y Y Y Y Y
Certreq N N N Y Y Y
Certutil N N N Y Y Y
Change N N N Y Y Y
Chcp Y Y Y Y Y Y
Chdir Y Y Y Y Y Y
Checknetisolation N N N N N Y
Chglogon N N N Y Y Y
Chgport N N N Y Y Y
Chgusr N N N Y Y Y
Chkdsk Y Y Y Y Y Y
Chkntfs N N Y Y Y Y
Choice Y Y N Y Y Y
Cipher N N Y Y Y Y
Clip N N N Y Y Y
Cls Y Y Y Y Y Y
Cmd N N Y Y Y Y
Cmdkey N N N Y Y Y
Cmstp N N Y Y Y Y
Color N N Y Y Y Y
Command Y Y Y1 Y1 Y1 Y1
Comp N N Y Y Y Y
Compact N N Y Y Y Y
Convert N N Y Y Y Y
Copy Y Y Y Y Y Y
Cscript N Y Y Y Y Y
Ctty Y Y N N N N
Date Y Y Y Y Y Y
Dblspace Y Y N N N N
Debug Y Y Y1 Y1 Y1 Y1
Defrag Y Y Y Y Y Y
Del Y Y Y Y Y Y
Deltree Y Y N N N N
Diantz N N Y Y Y N
Dir Y Y Y Y Y Y
Diskcomp Y Y Y Y Y Y
Diskcopy Y Y Y Y Y Y
Diskpart N N Y Y Y Y
Diskperf N N Y Y Y Y
Diskraid N N N Y Y Y
Dism N N N N Y Y
Dispdiag N N N Y Y Y
Djoin N N N Y Y Y
Doskey Y Y Y Y Y Y
Dosshell Y Y N N N N
Dosx N N Y1 Y1 Y1 Y1
Driverquery N N Y Y Y Y
Drvspace Y Y N N N N
Echo Y Y Y Y Y Y
Edit Y Y Y1 Y1 Y1 Y1
Edlin Y Y Y1 Y1 Y1 Y1
Emm386 Y Y N N N N
Endlocal N N Y Y Y Y
Erase Y Y Y Y Y Y
Esentutl N N Y Y Y Y
Eventcreate N N Y Y Y Y
Eventtriggers N N Y N N N
Exe2Bin N N Y1 Y1 Y1 Y1
Exit Y Y Y Y Y Y
Expand Y Y Y1 Y Y Y
Extrac32 N Y Y Y Y Y
Extract N Y N N N N
Fasthelp Y N N N N N
Fastopen Y Y Y1 Y1 Y1 Y1
Fc Y Y Y Y Y Y
Fdisk Y Y N N N N
Find Y Y Y Y Y Y
Findstr N N Y Y Y Y
Finger N N Y Y Y Y
Fltmc N N Y Y Y Y
Fondue N N N N N Y
For Y Y Y Y Y Y
Forcedos N N Y N N N
Forfiles N N N Y Y Y
Format Y Y Y Y Y Y
Fsutil N N Y Y Y Y
Ftp N Y Y Y Y Y
Ftype N N Y Y Y Y
Getmac N N Y Y Y Y
Goto Y Y Y Y Y Y
Gpresult N N Y Y Y Y
Gpupdate N N Y Y Y Y
Graftabl N Y Y1 Y1 Y1 Y1
Graphics Y Y Y1 Y1 Y1 Y1
Help Y Y Y Y Y Y
Hostname N N Y Y Y Y
Hwrcomp N N N N Y Y
Hwrreg N N N N Y Y
Icacls N N N Y Y Y
If Y Y Y Y Y Y
Interlnk Y N N N N N
Intersvr Y N N N N N
Ipconfig N Y Y Y Y Y
Ipxroute N N Y N N N
Irftp N N N Y Y Y
Iscsicli N N N Y Y Y
Kb16 N N Y1 Y1 Y1 Y1
Keyb Y Y N N N N
Klist N N N N Y Y
Ksetup N N N N Y Y
Ktmutil N N N Y Y Y
Label Y Y Y Y Y Y
Lh Y Y N N N N
Licensingdiag N N N N N Y
Loadfix Y Y Y1 Y1 Y1 Y1
Loadhigh Y Y N N N N
Lock N Y N N N N
Lodctr N Y Y Y Y Y
Logman N N Y Y Y Y
Logoff N N Y Y Y Y
Lpq N Y Y Y2 Y2 Y2
Lpr N Y Y Y2 Y2 Y2
Makecab N N Y Y Y Y
Manage-bde N N N N9 Y Y
Md Y Y Y Y Y Y
Mem Y Y Y1 Y1 Y1 Y1
Memmaker Y Y N N N N
Mkdir Y Y Y Y Y Y
Mklink N N N Y Y Y
Mode Y Y Y Y Y Y
Mofcomp N N Y Y Y Y
More Y Y Y Y Y Y
Mount N N N Y3 Y3 N
Mountvol N N Y Y Y Y
Move Y Y Y Y Y Y
Mrinfo N N Y Y Y Y
Msav Y N N N N N
Msbackup Y N N N N N
Mscdex Y Y N N N N
Msd Y N N N N N
Msg N N Y Y Y Y
Msiexec N N Y Y Y Y
Muiunattend N N N Y Y Y
Nbtstat N Y Y Y Y Y
Net N Y Y Y Y Y
Net1 N N Y Y Y Y
Netcfg N N N Y Y Y
Netsh N N Y Y Y Y
Netstat N Y Y Y Y Y
Nfsadmin N N N Y3 Y3 N
Nlsfunc Y Y Y1 Y1 Y1 Y1
Nltest N N N N Y Y
Nslookup N N Y Y Y Y
Ntbackup N N Y N N N
Ntsd N N Y N N N
Ocsetup N N N Y Y Y
Openfiles N N Y Y Y Y
Path Y Y Y Y Y Y
Pathping N N Y Y Y Y
Pause Y Y Y Y Y Y
Pentnt N N Y N N N
Ping N Y Y Y Y Y
Pkgmgr N N N Y Y Y
Pnpunattend N N N Y Y Y
Pnputil N N N Y Y Y
Popd N N Y Y Y Y
Power Y Y N N N N
Powercfg N N Y Y Y Y
Print Y Y Y Y Y Y
Prompt Y Y Y Y Y Y
Pushd N N Y Y Y Y
Pwlauncher N N N N N Y
Qappsrv N N Y Y Y Y
Qbasic Y Y4 N N N N
Qprocess N N Y Y Y Y
Query N N N Y Y Y
Quser N N N Y Y Y
Qwinsta N N Y Y Y Y
Rasautou N N Y Y Y Y
Rasdial N N Y Y Y Y
Rcp N N Y Y8 Y8 N
Rd Y Y Y Y Y Y
Rdpsign N N N N Y N
Reagentc N N N N Y Y
Recimg N N N N N Y
Recover N N Y Y Y Y
Reg N N Y Y Y Y
Regini N N Y Y Y Y
Register-cimprovider N N N N N Y
Regsvr32 N N Y Y Y Y
Relog N N Y Y Y Y
Rem Y Y Y Y Y Y
Ren Y Y Y Y Y Y
Rename Y Y Y Y Y Y
Repair-bde N N N N Y Y
Replace Y Y Y Y Y Y
Reset N N Y Y Y Y
Restore Y N N N N N
Rexec N N Y Y8 N N
Rmdir Y Y Y Y Y Y
Robocopy N N N Y Y Y
Route N Y Y Y Y Y
Rpcinfo N N N Y3 Y3 N
Rpcping N N N Y Y Y
Rsh N N Y Y8 Y8 N
Rsm N N Y Y N N
Runas N N Y Y Y Y
Rwinsta N N Y Y Y Y
Sc N N Y Y Y Y
Scandisk Y Y N N N N
Scanreg N Y N N N N
Schtasks N N Y Y Y Y
Sdbinst N N Y Y Y Y
Secedit N N Y Y Y Y
Set Y Y Y Y Y Y
Setlocal N N Y Y Y Y
Setspn N N N N Y Y
Setver Y Y Y1 Y1 Y1 Y1
Setx N N N Y Y Y
Sfc N N Y Y Y Y
Shadow N N Y Y Y N
Share Y Y Y1 Y1 Y1 Y1
Shift Y Y Y Y Y Y
Showmount N N N Y3 Y3 N
Shutdown N N Y Y Y Y
Smartdrv Y Y N N N N
Sort Y Y Y Y Y Y
Start N Y Y Y Y Y
Subst Y Y Y Y Y Y
Sxstrace N N N Y Y Y
Sys Y Y N N N N
Systeminfo N N Y Y Y Y
Takeown N N N Y Y Y
Taskkill N N Y Y Y Y
Tasklist N N Y Y Y Y
Tcmsetup N N Y Y Y Y
Telnet N Y Y Y5 Y5 Y5
Tftp N N Y Y6 Y6 Y6
Time Y Y Y Y Y Y
Timeout N N N Y Y Y
Title N N Y Y Y Y
Tlntadmn N N Y Y7 Y7 Y7
Tpmvscmgr N N N N N Y
Tracerpt N N Y Y Y Y
Tracert N Y Y Y Y Y
Tree Y Y Y Y Y Y
Tscon N N Y Y Y Y
Tsdiscon N N Y Y Y Y
Tskill N N Y Y Y Y
Tsshutdn N N Y N N N
Type Y Y Y Y Y Y
Typeperf N N Y Y Y Y
Tzutil N N N N Y Y
Umount N N N Y3 Y3 N
Undelete Y N N N N N
Unformat Y N N N N N
Unlock N Y N N N N
Unlodctr N N Y Y Y Y
Vaultcmd N N N N Y Y
Ver Y Y Y Y Y Y
Verify Y Y Y Y Y Y
Vol Y Y Y Y Y Y
Vsafe Y N N N N N
Vssadmin N N Y Y Y Y
W32tm N N Y Y Y Y
Waitfor N N N Y Y Y
Wbadmin N N N Y Y Y
Wecutil N N N Y Y Y
Wevtutil N N N Y Y Y
Where N N N Y Y Y
Whoami N N N Y Y Y
Winmgmt N N Y Y Y Y
Winrm N N N Y Y Y
Winrs N N N Y Y Y
Winsat N N N Y Y Y
Wmic N N Y Y Y Y
Wsmanhttpconfig N N N Y Y Y
Xcopy Y Y Y Y Y Y
Xwizard N N N N Y Y

[1] This command is not available in 64-bit versions of this operating system.

[2] This command is only available in this version of Windows when LPD Print Service is turned on from Windows Features.

[3] This command is only available in this version of Windows when Services for NFS is turned on from Windows Features.

[4] This command is only available in this version of Windows when copied from the installation media.

[5] This command is only available in this version of Windows when Telnet Client is turned on from Windows Features.

[6] This command is only available in this version of Windows when TFTP Client is turned on from Windows Features.

[7] This command is only available in this version of Windows when Telnet Server is turned on from Windows Features.

[8] This command is only available in this version of Windows when Subsystem for UNIX-based Applications is turned on from Windows Features and Utilities and SDK for UNIX-based Applications is downloaded for Windows Vista here or Windows 7 here.

[9] While there is no actual manage-bde command in Windows Vista, there is a manage-bde.wsf script that can be used to perform similar tasks via CScript.

[10] This command is only available in this version of Windows from the Command Prompt available in System Recovery Options.

Configuring NTP on windows


Configuration on Windows 2000 Workstation



Windows 2000 (Win2K) uses a time service, known as Windows Time
Synchronization Service (Win32Time), to ensure that all Win2K computers on your network
use a common time. The W32Time Service is a fully compliant implementation of the
Simple Network Time Protocol (SNTP) as detailed in IETF RFC 1769. SNTP uses UDP port
123 by default. If you want to synchronize your time server with an SNTP server on the
Internet, make sure that port is available.




  • Select a NTP server, using 





net time /setsntp:time-a.nist.gov






  • Start the W32time service with





net start W32Time



You can also set the start option of the Windows Time
Synchronization Service (W32Time) to Automatic, so the service will start when
Windows/2000 starts.




Set the following Registry Entries for the W32Time Service (marked
in blue color)



The registry values are located in the following registry
key:



HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters





  • AvoidTimeSyncOnWan : REG_DWORD (optional)

    Prevents the computer from synchronizing with a computer that is in another
    site.

    0 = the site of the time source is ignored [default]

    1 = the computer does not synchronize with a time source that is in a different
    site

     




  • GetDcBackoffMaxTimes : REG_DWORD (optional)

    The maximum number of times to double the backoff interval when successive
    attempts to find a domain controller do not succeed. An event is logged every time
    a wait of the maximum length occurs.

    0 = the wait between successive attempts is always the minimum and no event is
    logged

    7 = [default]

     




  • GetDcBackoffMinutes : REG_DWORD (optional)

    The initial number of minutes to wait before looking for a domain controller if
    the last attempt did not succeed. 15 = [default] 

     




  • LocalNTP : REG_DWORD

    Used to start the SNTP server.

    0 = do not start the SNTP server unless this computer is a domain
    controller[default]

    1 = always start the SNTP server

     





  • NtpServer : REG_SZ (swisstime.ethz.ch)

    NtpServer : REG_SZ (optional) Used to manually configure the time source. Set this
    to the DNS name or IP address of the NTP server to synchronize from. You can modify
    this from the command line by using the net time command. Value is blank by
    default

     





  • Period : REG_DWORD or REG_SZ

    Used to control how often the time service synchronizes. If a string value is
    specified, it must be one of special ones listed below.

    0 = once a day

    65535, "BiDaily" = once every 2 days

    65534, "Tridaily" = once every 3 days

    65533, "Weekly" = once every week (7 days)

    65532, "SpecialSkew" = once every 45 minutes
    until 3 good synchronizations occur, then once every 8 hours (3 per day)
    [default]

    65531, "DailySpecialSkew" = once every 45 minutes until 1 good synchronization
    occurs, then once every day

    freq = freq times per day

     





  • ReliableTimeSource : REG_DWORD (optional)

    Used to indicate that this computer has reliable time.

    0 = do not mark this computer as having reliable time [default]

    1 = mark this computer as having reliable time (this is only useful on a domain
    controller)

     





  • Type : REG_SZ

    Used to control how a computer synchronizes.

    Nt5DS = synchronize to domain hierarchy [default]

    NTP = synchronize to manually configured
    source


    NoSync = do not synchronize time



    The Nt5DS setting may not use a manual configured source.





The Adj and msSkewPerDay values are used to preserve information
about the computer’s clock between restarts. Do not manually edit these values.



More Information



For further information about NTP in
Windows/2000 see


http://support.microsoft.com/support/kb/articles/q224/7/99.asp

http://support.microsoft.com/support/kb/articles/q216/7/34.asp

http://support.microsoft.com/support/kb/articles/q223/1/84.asp

http://support.microsoft.com/support/kb/articles/q120/9/44.asp

http://support.microsoft.com/support/kb/articles/Q232/2/55.asp

http://labmice.techtarget.com/windows2000/timesynch.htm



For further information about NTP see


http://www.eecis.udel.edu/~ntp/

Windows Physical Memory Limits

Physical Memory Limits: Windows
Server 2008

The following table specifies the
limits on physical memory for Windows Server 2008.







































Version



Limit in 32-bit Windows



Limit in 64-bit Windows



Windows Server 2008 Datacenter (full installation)



64 GB



2 TB



Windows Server 2008 Datacenter (Server Core installation)



64 GB



2 TB



Windows Server 2008 Enterprise



64 GB



2 TB



Windows Server 2008 Standard



4 GB



32 GB



Windows Server 2008 for Itanium-Based Systems



Not applicable



2 TB



Windows Web Server 2008



4 GB



32 GB



Physical
Memory Limits: Windows Vista


The following table specifies the
limits on physical memory for Windows Vista.







































Version



Limit in 32-bit Windows



Limit in 64-bit Windows



Windows Vista Ultimate



4 GB



128 GB



Windows Vista Enterprise



4 GB



128 GB



Windows Vista Business



4 GB



128 GB



Windows Vista Home Premium



4 GB



16 GB



Windows Vista Home Basic



4 GB



8 GB



Windows Vista Starter



1 GB



Not applicable



Physical
Memory Limits: Windows Server 2003


The following table specifies the
limits on physical memory for Windows Server 2003.










































































Version



Limit in 32-bit Windows



Limit in 64-bit Windows



Windows Server 2003, Datacenter Edition SP2



128 GB


64 GB with 4GT



2 TB



Windows Server 2003, Enterprise Edition SP2



64 GB



2 TB



Windows Storage Server 2003, Enterprise Edition



8 GB



Not applicable



Windows Storage Server 2003



4 GB



Not applicable



Windows Server 2003,
Datacenter Edition R2


Windows Server 2003, Datacenter Edition SP1



128 GB


16 GB with 4GT



1 TB



Windows Server 2003,
Enterprise Edition R2


Windows Server 2003, Enterprise Edition SP1



64 GB


16 GB with 4GT



1 TB



Windows Server 2003, Standard
Edition R2


Windows Server 2003, Standard Edition SP1



4 GB



32 GB



Windows Server 2003, Datacenter Edition



128 GB


16 GB with 4GT



512 GB



Windows Server 2003, Enterprise Edition



32 GB


16 GB with 4GT



64 GB



Windows Server 2003, Standard Edition



4 GB



16 GB



Windows Server 2003, Web Edition



2 GB



Not applicable



Windows Small Business Server 2003



4 GB



128 GB



Windows Compute Cluster Server 2003



Not applicable



128 GB



Physical
Memory Limits: Windows XP


The following table specifies the
limits on physical memory for Windows XP.



















Version



Limit in 32-bit Windows



Limit in 64-bit Windows



Windows XP



4 GB



128 GB



Windows XP Starter Edition



256 MB



Not applicable


Restarting Windows Without Restarting Your PC

Sometimes, you need to reboot Windows (e.g. when installing new software), but there is no need to restart BIOS, too. However, the default is to reboot both. (That’s called doing a “cold boot,” rather than a “warm boot.”) There’s a trick that works on both XP and Vista to get it to do a warm boot instead, thus saving you 30 seconds per cycle.

The trick is to hold down the SHIFT key when invoking the restart.
Windows Vista: Select Start, then hover over the right arrow that is to the right of the padlock icon until the pop-up menu appears that contains “restart” as one of it’s choices. Hold down the SHIFT key while clicking on the “restart” choice.

Windows XP: Select Start. Select “Shut Down…”. Change the drop-down combo box under “What do you want the computer to do?” to “Restart”. Hold down the SHIFT key while clicking on the “OK” button.

Adjust Windows DNS cache

Adjust Windows’ DNS cache

To speed up DNS, Windows puts the DNS information into a local DNS cache on your PC when you visit a site. So when you want to go to a site, Windows first looks in its local DNS cache, called the resolve cache, to see whether the DNS information is contained there. That way, if it finds the information locally, it doesn’t have to look in your HOSTS file or query a remote DNS server to find IP information. The cache is made up of recently queried names and entries taken from your HOSTS file.

The cache contains both negative and positive entries. Positive entries are those in which the DNS lookup succeeded and you were able to connect to the Web site. When Windows looks in the cache, if it finds a positive entry, it immediately uses that DNS information and sends you to the requested Web site.

Negative entries are those in which no match was found, and you end up getting a "Cannot find server or DNS" error in your browser. Similarly, when Windows looks in the cache and finds a negative entry, it gives you the error message without bothering to go out to the site.

Negative entries can lead to problems. When you try to make a connection to a site that has a negative entry in your cache, you’ll get an error message, even if the site’s problems have been resolved and it’s now reachable.

You can solve this problem, though, using a Registry hack. By default, Windows caches negative entries for five minutes. After five minutes, they’re cleared from your cache.

But if you’d like, you can force Windows not to cache these negative entries so that you’ll never run into this problem. Run the Registry Editor by typing Regedit at a command prompt or the Windows Vista search box, and press Enter. Then go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters. Create a new DWORD value with the name NegativeCacheTime and give it a value of 0. (The value might already exist. If it does, edit its value to 0.)

The DWORD determines how much time, in seconds, to keep negative entries in the DNS cache. If you like, you can have the entries stay alive for one second by giving the DWORD a value of 1.

After you’re done editing, exit the Registry. To make the change take effect, restart your computer, or flush your cache by issuing the command ipconfig /flushdns at a command prompt. The command will flush your DNS cache — all the entries, both positive and negative, will be flushed — and it will be empty until you start visiting Web sites. Negative entries, however, will not be added to the cache if you’ve given the DWORD a value of 0.

You can also use the Registry to control the amount of time positive entries are kept in the DNS cache. By default, they are kept for 24 hours. To change the default, go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters again and create a DWORD value called MaxCacheEntryTtlLimit. (If it’s already present, just edit the value.) For the value, enter the amount of time you want the entry to remain, in seconds, making sure to use decimals as the base.

WAMP server for windows

WAMP server for windows
(Windows Apache Mysql Php)

This works well on windows 2000, XP, Vista. Of course with Vista there are a few ACL hoops you have to jump through which I will not discuss.

1. Download wampserver from http://www.wampserver.com (I’m using wamp5_1.7.0.exe)

2. Install with defaults – DO NOT SELECT AUTOMATIC STARTUP!

Out of the box it will not work (WTF?)

3. edit C:\wamp\Apache2\conf\http.conf

change the section at DocumentRoot to look like this:
—————————————————–

DocumentRoot "C:/wamp/www"


Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Satisfy all

change the following section to look like this:
———————————————————–


Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all

4. Now the default install gives you access to phpmyadmin and sqlitemanager. But guess
what? with the default install you can’t access them, you just get a permission error.
Go to the forums and you will get non-answers to the problem. Go nuts or read on…

Fix phpmyadmin and sqlitemanager:
———————————

edit C:\wamp\Apache2\conf\alias\phpmyadmin.conf

make it look like this:

Alias /phpmyadmin/ "c:/wamp/phpmyadmin/"

Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Allow,Deny
Allow from all

edit C:\wamp\Apache2\conf\alias\sqlitemanager.conf

make it look like this:

Alias /sqlitemanager/ "c:/wamp/sqlitemanager/"

Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Allow,Deny
Allow from all

Restart (or start) Wampserver

point your browser at http://127.0.0.1

default directory is:

C:\wamp\www

—–Dax

Clear IE7 Browsing History From the Command Line

Temporary Internet Files

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8

Cookies

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2

History

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1

Form Data

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16

Passwords

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32

Delete All

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255

Delete All – “Also delete files and settings stored by add-ons”

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351

These commands should work in Internet Explorer 7 on XP or on Windows Vista.

Defrag Multiple Hard Drives At Once In Windows

Defrag Multiple Hard Drives At Once In Windows

The Disk Defragment utility in Windows XP does not include a way to defragment all hard drives at the same time, which is inconvienient when you have more than one hard drive in your computer.

The method we are going to use is by creating a batch file to defragment all of the drives, one after the other.

The disk defrag utility in Windows XP can be triggered from the command line with the following syntax:

Windows Disk Defragmenter
Copyright (c) 2001 Microsoft Corp. and Executive Software International, Inc.
Usage:
defrag [-a] [-f] [-v] [-?]
volume drive letter or mount point (d: or d:volmountpoint)
-a Analyze only
-f Force defragmentation even if free space is low
-v Verbose output
-? Display this help text

First, we’ll create a file named defragall.bat, and place it anywhere you like, as long as you’ll remember where it is. If you want to run it from the command line, you could place it in the \windows directory so that it will be available in the system path.

For each hard drive, add a line to the batch file. For instance, if we want to defragment drives C: , D: , and F: we will add these three lines:

defrag c: -f
defrag d: -f
defrag f: -f

To run the defrag, just either double-click on the batch file or start it from the command line.