Skip to content

Instantly share code, notes, and snippets.

@tathamoddie
Created August 5, 2010 03:48
Show Gist options
  • Save tathamoddie/509197 to your computer and use it in GitHub Desktop.
Save tathamoddie/509197 to your computer and use it in GitHub Desktop.
Batch file to automatically detect, download and install PowerShell 2 on to an XP SP3 machine
REM Originally from http://blog.codeassassin.com/2009/12/10/no-web-browser-need-powershell/
echo class Program { public static void Main() { >"%~dpn0.cs"
echo using (var wc = new System.Net.WebClient()) { >>"%~dpn0.cs"
echo wc.DownloadFile(@"http://download.microsoft.com/download/1/1/7/117FB25C-BB2D-41E1-B01E-0FEB0BC72C30/WindowsServer2003-KB968930-x86-ENG.exe", @"%~dpn0.installer.exe");}}} >>"%~dpn0.cs"
"%systemroot%\microsoft.net\framework\v3.5\csc.exe" /out:"%~dpn0.exe" "%~dpn0.cs"
"%~dpn0.exe"
"%~dpn0.installer.exe"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment