Skip to content

Instantly share code, notes, and snippets.

@Romiko
Created November 1, 2011 05:18
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 Romiko/1329984 to your computer and use it in GitHub Desktop.
Save Romiko/1329984 to your computer and use it in GitHub Desktop.
Powershell Proxy Script - Written by Jason Stangroome
@echo off
setlocal
set tempscript=%temp%\%~n0.%random%.ps1
echo $ErrorActionPreference="Stop" >"%tempscript%"
echo ^& "%~dpn0.ps1" %* >>"%tempscript%"
powershell.exe -command "& \"%tempscript%\""
set errlvl=%ERRORLEVEL%
del "%tempscript%"
exit /b %errlvl%
@Romiko
Copy link
Author

Romiko commented Nov 1, 2011

The proxy script just writes a temporary PowerShell script containing all the arguments you’re trying to pass to let PowerShell interpret them and avoid getting them messed up by the Win32 native command line parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment