Thursday, April 21, 2011

Command line shortcuts

for service starting stopping or even remote event viewing...shortcuts

I made a batch file that does this


set /p compname=Enter the computer name:
start mmc compmgmt.msc /computer:\\%compname%
set compname=

The original had c:\windows\system32\compmgmt.msc but on my system it doesn't appear to be needed
you can replace compmgmt.msc with services.msc or eventvwr.msc

Also to pipe into notepad:


set /p compname=Enter the computer name:
sc \\%compname% query type= service | find "SERVICE_" > %temp%\tmpsvc.txt
start notepad %temp%\tmpsvc.txt
ping -n 2 127.0.0.1
del %temp%\tmpsvc.txt
set compname=


the ping is there because the delete would fire much faster than the notepad starting up, so it's a sleep hack.