log in


Luke Breuer
2010-05-04 22:56 UTC
tags: cmd.exe

cmd.exe (Wikipedia) is a Windows shell for NT through Vista and probably beyond. It will be obsoleted by PowerShell, but it will unfortunately be around for a long time. This page exists to lessen the pain you experience when dealing with cmd.exe.
I highly suggest downloading everything in GNU Coreutils to get much better text processing.
replacement "GUIs"
Best cmd.exe documentation?
some syntax
  • comment by prepending a line with REM
  • prevent a line from being echoed by prepending @
  • turn off echoing: @echo off
  • cmdline args: %1, %2, ...
  • pushd and popd to save/restore paths while cding around
  • cd.. works just like cd ..
  • `cd ` to go to the root
  • pushd \server\installs to access UNC paths
  • prompt for value: set /p my_variable=Enter a value, please:
  • print variable: echo %my_variable%
  • help
    • help
    • set /?
    • for /?
    • if /?
    • goto /?
    • call /?

random stuff
sed s/^|^|/^|\"\"^|/g
is the same as
sed "s/||/|\"\"|/g"