Last active
August 24, 2018 14:31
-
-
Save techthoughts2/3aa4583fff3dcfa1e0abe0aed502b4b2 to your computer and use it in GitHub Desktop.
Running commands in CMD from powershell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$command = 'C:\somepath\someexe.exe somearg' | |
iex $command | |
#full working example | |
$command = 'cmd.exe /c "C:\Program Files (x86)\Bginfo\BgInfo.exe" "C:\Program Files (x86)\Bginfo\config_2016.bgi\" /silent /accepteula /timer:0' | |
iex "& $command" | |
#issue the command | |
cmd.exe /c dir /w | |
#leaves the argument untouched | |
cmd.exe --% /c dir %WINDIR% /w |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment