command-line in Windows14 Jul 2011
I personally prefer the bash even in cygwin over the dos shell many times, but it’s often the only shell available and has more features on windows.
An example would be of course system administration stuff, like starting services – the windows equivalent of UNIX daemons:
net start/stop *service-name*
or killing processes by pid:
taskkill /pid 1234
taskkill /IF "abc.exe"
or by window title – thanks to windows hard coupling of GUI and OS:
taskkill /IM * /FI "WindowTitle eq *window title wo quotes*"
shutting down (See this blog entry):
In conjunction with killing processes by WindowTitle it’s nice to know how to set the title of the command prompt:
Some commands are especially useful if you have to automatically setup a system.
Change the hostname:
wmic computersystem where name="%COMPUTERNAME%" call rename name="NEW"
reset windows vista/7 activation grace period to 30 days (can be done up to 3 times):
enter windows 7 product key
start windows 7 online activation
Generally useful stuff in the dos shell:
echo 1 && echo b