Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :::::::::::::::::::::::::::::::::::::::::::::::
- ::Auto File Downloader + Auto Run ::
- ::Created by RU$$ [http://russdev.mooo.com/] ::
- :::::::::::::::::::::::::::::::::::::::::::::::
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::
- ::Config
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::
- ::File download URL (Dirrect only)
- SET URL=http://russdev.mooo.com/extra/foo.zip
- ::File extract location (DEFAULT: Batch location)
- SET mypath=%~dp0
- SET CreateFolder=1
- SET FolderName=DownloadedFiles
- ::File to auto-run (Must include extension)
- SET Enabled=1
- SET FileName=click.exe
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::
- ::Code start
- @echo off
- echo Downloading file to batch dirrectory.
- bitsadmin /transfer mydownloadjob /download /priority normal ^ %URL% %mypath%\x.zip
- echo Extracting file.
- powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('x.zip', '%FolderName%'); }"
- echo Moving the files out of folder. (If Enabled)
- IF %CreateFolder%==1 (goto :CON) else (goto :MOVE)
- ::If move was a GO
- :MOVE
- move "%mypath%\%FolderName%\*" "%mypath%"
- echo Cleaning up files.
- RD /S /Q "%mypath%\%FolderName%"
- del /F /Q "%mypath%\x.zip"
- cls
- echo Job has finished!
- ::Check if run
- IF %Enabled%==1 (goto :RUN) else (goto :STOP)
- :RUN
- echo.
- echo Running the app.
- %mypath%\%FileName%
- pause >nul
- exit
- :STOP
- pause >nul
- exit
- ::If Move was a NO
- :CON
- echo Cleaning up files.
- del /F /Q "%mypath%\x.zip"
- cls
- echo Job has finished!
- ::Check if run
- IF %Enabled%==1 (goto :RUN2) else (goto :STOP2)
- :RUN2
- echo.
- echo Running the app.
- %mypath%\%FolderName%\%FileName%
- pause >nul
- exit
- :STOP2
- pause >nul
- exit
Add Comment
Please, Sign In to add comment