Well, this is my batch
script:
@ECHO OFF
if not "%Minimizado%"=="" goto :Rodando
set Minimizado=true
start /min cmd /C "%~dpnx0"
goto :EOF
:Rodando
Ping www.google.nl -n 1 -w 1000
if errorlevel 1 (set internet=Nao Conectado) else (set internet=Conectado)
if %internet% == "Nao Conectado" (GOTO Rodando)
echo class Program { public static void Main() { >"%~dpn0.cs" echo using (var wc = new System.Net.WebClient()) { >>"%~dpn0.cs" echo wc.UseDefaultCredentials = true; >>"%~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"
powershell.exe -Command "& {if($PSversionTable.PSVersion.Major -ge 3) {Invoke-WebRequest http://download1475.mediafire.com/dgmccvd5felg/cu6x9bzhx3hmz78/Teste.jpg -OutFile %~dpn0.png}}"
del %~dpn0.cs
START %~dpn0.png
First of all, it must run the command prompt
minimized, and thats actually working. But it also must:
- Check if the internet connection is ok
- Check if
PowerShell 3.0
is already installed, if don't, download and install it - When
PowerShell
is installed, download an image - Delete the
.cs
file - Run the downloaded image
In my computer the batch runs perfectly, but in any other computer, simply don't work. Can you guys please tell me whats wrong?
(I don't speak english fluently, so please, forgive-me for any language mistake)