Skip to content

Instantly share code, notes, and snippets.

@techthoughts2
Last active August 24, 2018 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techthoughts2/3aa4583fff3dcfa1e0abe0aed502b4b2 to your computer and use it in GitHub Desktop.
Save techthoughts2/3aa4583fff3dcfa1e0abe0aed502b4b2 to your computer and use it in GitHub Desktop.
Running commands in CMD from powershell
$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