Q. Do normal Windows commands run in PowerShell?
Generally, yes. There are times, however, when PowerShell's parsing of commands results in unexpected and confusing errors.
September 22, 2010
Q. Do normal Windows commands run in PowerShell?
A. Generally, yes. There are times, however, when PowerShell's parsing of commands results in unexpected and confusing errors. Sometimes, you'll need to enclose your entire command string within quotation marks and use the shell's invoke operator to run the command:
&"SC.EXE STOP WUAUSERV"
That's a good example because it uses the external Sc.exe command rather than PowerShell's internal SC alias. If you just run
SC STOP WUAUSERV
the built-in SC command will run, accepting STOP and WUAUSERV as input parameters. As a result, you'll get an error.
Do you have a Windows PowerShell question? Find more PowerShell FAQs, articles, and other resources at windowsitpro.com/go/DonJonesPowerShell.
About the Author
You May Also Like