Created
November 1, 2011 05:18
-
-
Save Romiko/1329984 to your computer and use it in GitHub Desktop.
Powershell Proxy Script - Written by Jason Stangroome
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
@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% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.