I've made a batch file for making Windows Bootable USB. Is there any advanced Script? Spoiler @echo off title Bootable USB by KAMRULCOX color 4f mode con lines=20 cols=80 echo. echo. echo. echo. echo.=============================================================================== echo It will delete important data from your USB !!! echo.=============================================================================== echo. echo. echo. echo. echo. [Y] = Agree. echo. [N] = Exit. echo. rompt set /P choice= Are you agree? Press "Y" for agree and "N" for exit: if %choice%==Y goto 1 if %choice%==N goto 2 if %choice%==y goto 1 if %choice%==n goto 2 goto error :1 cls color 2f mode con lines=20 cols=60 echo>list.txt echo>list.txt list disk diskpart -s list.txt set /p disk= See the list above and enter your USB Disk No: echo >> disk.txt select disk %disk% echo >> disk.txt clean echo >> disk.txt create partition primary echo >> disk.txt active echo >> disk.txt assign del list.txt /q echo. Please wait... ping 127.0.0.1 >nul cls mode con lines=30 cols=70 diskpart -s disk.txt ping 127.0.0.1 >nul echo. echo. echo. taskkill /f /im explorer.exe start explorer.exe ping 127.0.0.1 >nul set /p Letter= Now enter USB Drive Letter: format %Letter%: /fs:ntfs /v:Windows /q /y ping 127.0.0.1 >nul del disk.txt /q goto 2 :error cls color 4f mode con lines=10 cols=40 echo. echo. echo. ECHO. ECHO. Wrong Command !! ECHO. ping 127.0.0.1 >nul exit /b :2 cls mode con lines=10 cols=40 echo. echo. echo. ECHO ================================== ECHO Thanks ECHO ================================== ping 127.0.0.1 >nul exit /b
I changed things around a little bit if you want to try ..is there a way we can run this automatically as admin? EDIT: added Admin rights. Thanks to s1ave77 Spoiler Code: @echo off ::BatchGotAdmin openfiles >nul 2>&1 if %errorlevel% NEQ 0 goto :UACPrompt goto :gotAdmin :UACPrompt echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" echo UAC.ShellExecute "%~f0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" exit /b :gotAdmin title Bootable USB by KAMRULCOX color 4f mode con lines=20 cols=80 echo. echo. echo. echo. echo.================================================================================ echo ((WARNING))this will delete all data from your USB!((WARNING)) echo.================================================================================ echo. echo. echo. echo. echo. [Y] = AGREE echo. [N] = EXIT echo. :Prompt set /P choice= Please type "Y" to agree or "N" to exit: if %choice%==Y goto 1 if %choice%==N goto 2 if %choice%==y goto 1 if %choice%==n goto 2 goto error :1 echo. echo. echo. echo. [N] = NTFS echo. [F] = FAT32 echo. :Prompt set /P choice= Please type "N" or "F" to continue: if %choice%==n goto 1A if %choice%==f goto 1B if %choice%==N goto 1A if %choice%==F goto 1B goto error :1A cls color 4f mode con lines=20 cols=80 echo>list.txt echo>list.txt list disk diskpart -s list.txt echo. echo. set /p disk= Enter your USB Disk # from above: echo >> disk.txt select disk %disk% set /p choice= Did you select the right Disk? Please type "YES" or "NO": if %choice%==YES goto 1C if %choice%==NO goto error if %choice%==yes goto 1C if %choice%==no goto error goto error :1C echo >> disk.txt clean echo >> disk.txt create partition primary echo >> disk.txt select partition 1 echo >> disk.txt format fs=ntfs label="BootUSB" quick echo >> disk.txt assign echo >> disk.txt active del list.txt /q echo. Please wait... ping 127.0.0.1 >nul cls mode con lines=20 cols=80 diskpart -s disk.txt echo >> disk.txt rescan ping 127.0.0.1 >nul echo. echo. echo. del disk.txt /q goto 2 :1B cls color 4f mode con lines=20 cols=80 echo>list.txt echo>list.txt list disk diskpart -s list.txt echo. echo. set /p disk= Enter your USB Disk # from above: echo >> disk.txt select disk %disk% set /p choice= Did you select the right Disk? Please type "YES" or "NO": if %choice%==YES goto 1D if %choice%==NO goto error if %choice%==yes goto 1D if %choice%==no goto error goto error :1D echo >> disk.txt clean echo >> disk.txt create partition primary echo >> disk.txt select partition 1 echo >> disk.txt format fs=fat32 label="BootUSB" quick echo >> disk.txt assign echo >> disk.txt active del list.txt /q echo. Please wait... ping 127.0.0.1 >nul cls mode con lines=20 cols=80 diskpart -s disk.txt echo >> disk.txt rescan ping 127.0.0.1 >nul echo. echo. echo. del disk.txt /q goto 2 :error cls color 4f mode con lines=10 cols=40 del disk.txt /q del list.txt /q echo. echo. echo. ECHO. ECHO. Wrong Command !! ECHO. ping 127.0.0.1 >nul exit /b :2 cls mode con lines=10 cols=40 echo. echo. echo. ECHO ================================== ECHO Thanks ECHO ================================== ping 127.0.0.1 >nul exit /b
To run it automatically as admin, this would be one way (set at beginning of a script): Code: ::BatchGotAdmin openfiles >nul 2>&1 if %errorlevel% NEQ 0 goto :UACPrompt goto :gotAdmin :UACPrompt echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" echo UAC.ShellExecute "%~f0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" exit /b :gotAdmin
As DISKPART is used here, it´s recommended to add a little warning to assure using the correct drive number. DISKPART unfortunately asks no further questions and will wipe a chosen drive instantly, in case the wrong number is used, one will have to recover all data . Learned the lesson the hard way...back in the days .
Thank you Kamrul08 for posting this script. I have been wanting to create one for myself so I used yours as a base for this. I just added Admin rights thanks to s1ave77 , added a warning before formatting Disk as requested , and lastly , added the choice of NTFS or FAT32. Spoiler Code: @echo off ::BatchGotAdmin openfiles >nul 2>&1 if %errorlevel% NEQ 0 goto :UACPrompt goto :gotAdmin :UACPrompt echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" echo UAC.ShellExecute "%~f0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" exit /b :gotAdmin title Bootable USB by KAMRULCOX color 4f mode con lines=20 cols=80 echo. echo. echo. echo. echo.================================================================================ echo ((WARNING))this will delete all data from your USB!((WARNING)) echo.================================================================================ echo. echo. echo. echo. echo. [Y] = AGREE echo. [N] = EXIT echo. :Prompt set /P choice= Please type "Y" to agree or "N" to exit: if %choice%==Y goto 1 if %choice%==N goto 2 if %choice%==y goto 1 if %choice%==n goto 2 goto error :1 echo. echo. echo. echo. [N] = NTFS echo. [F] = FAT32 echo. :Prompt set /P choice= Please type "N" or "F" to continue: if %choice%==n goto 1A if %choice%==f goto 1B if %choice%==N goto 1A if %choice%==F goto 1B goto error :1A cls color 4f mode con lines=20 cols=80 echo>list.txt echo>list.txt list disk diskpart -s list.txt echo. echo. set /p disk= Enter your USB Disk # from above: echo >> disk.txt select disk %disk% set /p choice= Did you select the right Disk? Please type "YES" or "NO": if %choice%==YES goto 1C if %choice%==NO goto error if %choice%==yes goto 1C if %choice%==no goto error goto error :1C echo >> disk.txt clean echo >> disk.txt create partition primary echo >> disk.txt select partition 1 echo >> disk.txt format fs=ntfs label="BootUSB" quick echo >> disk.txt assign echo >> disk.txt active del list.txt /q echo. Please wait... ping 127.0.0.1 >nul cls mode con lines=20 cols=80 diskpart -s disk.txt echo >> disk.txt rescan ping 127.0.0.1 >nul echo. echo. echo. del disk.txt /q goto 2 :1B cls color 4f mode con lines=20 cols=80 echo>list.txt echo>list.txt list disk diskpart -s list.txt echo. echo. set /p disk= Enter your USB Disk # from above: echo >> disk.txt select disk %disk% set /p choice= Did you select the right Disk? Please type "YES" or "NO": if %choice%==YES goto 1D if %choice%==NO goto error if %choice%==yes goto 1D if %choice%==no goto error goto error :1D echo >> disk.txt clean echo >> disk.txt create partition primary echo >> disk.txt select partition 1 echo >> disk.txt format fs=fat32 label="BootUSB" quick echo >> disk.txt assign echo >> disk.txt active del list.txt /q echo. Please wait... ping 127.0.0.1 >nul cls mode con lines=20 cols=80 diskpart -s disk.txt echo >> disk.txt rescan ping 127.0.0.1 >nul echo. echo. echo. del disk.txt /q goto 2 :error cls color 4f mode con lines=10 cols=40 del disk.txt /q del list.txt /q echo. echo. echo. ECHO. ECHO. Wrong Command !! ECHO. ping 127.0.0.1 >nul exit /b :2 cls mode con lines=10 cols=40 echo. echo. echo. ECHO ================================== ECHO Thanks ECHO ================================== ping 127.0.0.1 >nul exit /b If I knew more about batch commands I might have been able to clean it up more. This has been a great learning experience for me , again , thanks to Kamrul08
auto admin worked until i restarted computer..now script pops up UAC again ,even if i right click and "run as"...
Here is one I wrote about 4 years ago for my computer business originally for Win 7 but works well for 8 and 8.1 also..DP Code: @echo off&color a&setlocal enabledelayedexpansion title WINDOWS 7 USB BOOTABLE OS TOOL :: Note: Right Click and RunAs Admin :################################################################################# :# Copyright © 2010, Geeks Computer Services. All rights reserved. # :# # :# You may use this code and information is provided "as is" without warranty, # :# If this code and information is modified, the entire risk of use or results # :# in connection with the use of this code and information remains with the user # :################################################################################# cd %~dp0 xcopy "%~dp0\dat\Install.Notes.rtf" "%userprofile%\desktop"/i/c/q/h/y/s>nul echo Please read the Install Notes before proceeding then press any [KEY] to Begin..&&PAUSE>NUL cls echo NOTE: Insert Your USB Thumbdrive and DVD then press any [KEY] to Begin...&&PAUSE>NUL ::USB Bootable OS Tool:: ::SCAN DRIVES:: set Counter=0 set Schalter=2 set Width=0 :1 title SCANNING USB AND DVD DRIVES set /a Counter=%Counter% + 1 set /a Display=%Counter% / 2 FOR /L %%A IN (1,1,%Display%) DO ( set Display=!Display!² ) cls echo SCANNING USB AND DVD DRIVES... %Counter%%% echo ²!Display:~2,47! ping localhost -n 1 >nul if "%Counter%" == "100" goto :1-End goto :1 :1-End echo. echo. cls title CREATE DISKPART SCRIPT AND BAT FILE echo IMPORTANT: Make A Note of USB Disk#, and USB-DVD Drive Letters... echo. echo Then [Exit] out of Disk Management to Begin... echo. diskmgmt.msc echo Did you get the USB Disk# and USB-DVD Drive Letters? echo If So..Press Any [KEY] to Continue...&&PAUSE>NUL cls ::==SET %VARIABLE% VALUES==:: echo WARNING: ::: ALL INFORMATION ON YOUR USB DRIVE WILL BE DELETED ::: echo. echo. set /p Disk=Please Enter USB Disk NUMBER: if "%Disk%"=="" goto :eof echo. set /p USB=Please Enter USB Disk LETTER: if "%USB%"=="" goto :eof echo. set /p DVD=Please Enter CD-ROM/DVD Disk LETTER: if "%DVD%"=="" goto :eof echo. ::==============================================+ ::==CREATE DISKPART SCRIPT FILE==:: echo>>%userprofile%\desktop\Script.txt Select Disk %disk% echo>>%userprofile%\desktop\Script.txt Clean echo>>%userprofile%\desktop\Script.txt Create Partition Primary echo>>%userprofile%\desktop\Script.txt Select Partition 1 echo>>%userprofile%\desktop\Script.txt Active echo>>%userprofile%\desktop\Script.txt FORMAT FS=ntfs label="WIN7.PRO.X64" quick echo>>%userprofile%\desktop\Script.txt Assign letter=%usb% noerr echo>>%userprofile%\desktop\Script.txt End ::==============================================+ ::==CREATE INSTALLER BATCH SCRIPT==:: set del=del/f/q %homepath%\desktop\ echo>>%userprofile%\desktop\USB.Format.Tool.bat @echo off echo>>%userprofile%\desktop\USB.Format.Tool.bat color e echo>>%userprofile%\desktop\USB.Format.Tool.bat title W7 Bootable USB echo>>%userprofile%\desktop\USB.Format.Tool.bat DiskPart.exe /s Script.txt echo>>%userprofile%\desktop\USB.Format.Tool.bat echo. echo>>%userprofile%\desktop\USB.Format.Tool.bat echo. echo>>%userprofile%\desktop\USB.Format.Tool.bat cls echo>>%userprofile%\desktop\USB.Format.Tool.bat echo +=================================================+ echo>>%userprofile%\desktop\USB.Format.Tool.bat echo + Creating a Bootable USB Flash Drive. + echo>>%userprofile%\desktop\USB.Format.Tool.bat echo +=================================================+ echo>>%userprofile%\desktop\USB.Format.Tool.bat echo. echo>>%userprofile%\desktop\USB.Format.Tool.bat echo. echo>>%userprofile%\desktop\USB.Format.Tool.bat del/f/q c:%homepath%\desktop\Script.txt echo>>%userprofile%\desktop\USB.Format.Tool.bat echo. echo>>%userprofile%\desktop\USB.Format.Tool.bat echo Please wait while files or copied over... echo>>%userprofile%\desktop\USB.Format.Tool.bat xcopy %dvd%:\*.* %usb%:\ /s/e/h/f/c/q echo>>%userprofile%\desktop\USB.Format.Tool.bat cls echo>>%userprofile%\desktop\USB.Format.Tool.bat echo Your Thumbdrive OS Completed Successfully... echo>>%userprofile%\desktop\USB.Format.Tool.bat echo. echo>>%userprofile%\desktop\USB.Format.Tool.bat echo. echo>>%userprofile%\desktop\USB.Format.Tool.bat echo This Screen will now Close. echo>>%userprofile%\desktop\USB.Format.Tool.bat echo. echo>>%userprofile%\desktop\USB.Format.Tool.bat pause echo>>%userprofile%\desktop\USB.Format.Tool.bat exit echo>>%userprofile%\desktop\USB.Format.Tool.bat :: Geeks Computer Services. 08.12 :: ::==============================================+ cls title ALL INSTALL FILES CREATED SUCCESSFULLY color e echo You Can Now..Dbl Click on USB.Format.Tool.bat to Install OS to USB... echo. echo Press any [KEY] to Close-Out this Screen...&&PAUSE>NUL :EOF Exit :08-10-12:
That's a pretty nice looking script. Just need to add that if you want to be able to boot in UEFI mode then you need to format your key as Fat32 NOT NTFS.
Thanks leebo 28. s1ave77's automatically as admin option will be good. Does it support standard user? My another quesions- in your command select partition 1 may affect another disk if there is more than 2 disk. Is not it? Sorry for my foolish question.
It will only use the commands on the "disk" that was chosen, as for the admin part..I was trying to avoid having to right click and "run as Administrator" but it seems either way it has to be done..at least once.
Afaik yes.... The part was found in one of the scripting threads here at MDL. It checks whether the tool was started with proper Elevation and in case it wasn´t, it creates a VBS file that will start the script once again whith elevated rights. The VBS is deleted afterwards .
UEFI was not a big deal 4 yrs ago, but good point could always add a format option for Fat 32 as well..DP
Thanks s1ave77. I've understood the matter. Is there any way if I want to make Win XP bootable USB like this?
Revised Update Update to my USB Bootable OS Tool from post #9 (not tested) - Added fat32 (for uefi) or ntfs system file types and finish time for your usb os installation. DP Code: @echo off&color a&setlocal enabledelayedexpansion title WINDOWS USB BOOTABLE OS TOOL :: Note: Right Click and RunAs Admin :################################################################################# :# Copyright © 2010, Geeks Computer Services. All rights reserved. # :# # :# You may use this code and information is provided "as is" without warranty, # :# If this code and information is modified, the entire risk of use or results # :# in connection with the use of this code and information remains with the user # :################################################################################# cd %~dp0 echo Please read the Install Notes before proceeding then press any [KEY] to Begin..&&PAUSE>NUL cls echo NOTE: Insert Your USB Thumbdrive and DVD then press any [KEY] to Begin...&&PAUSE>NUL ::USB Bootable OS Tool:: ::SCAN DRIVES:: set Counter=0 set Schalter=2 set Width=0 :1 title SCANNING USB AND DVD DRIVES set /a Counter=%Counter% + 1 set /a Display=%Counter% / 2 FOR /L %%A IN (1,1,%Display%) DO ( set Display=!Display!² ) cls echo SCANNING USB AND DVD DRIVES... %Counter%%% echo ²!Display:~2,47! ping localhost -n 1 >nul if "%Counter%" == "100" goto :1-End goto :1 :1-End echo. echo. cls title CREATE DISKPART SCRIPT AND BATCH FILE echo IMPORTANT: Make A Note of USB Disk#, and USB-DVD Drive Letters... echo. echo Then [Exit] out of Disk Management to Begin... echo. diskmgmt.msc echo Did you get the USB Disk# and USB-DVD Drive Letters? echo If So..Press Any [KEY] to Continue...&&PAUSE>NUL cls ::==SET %VARIABLE% VALUES==:: echo WARNING: ::: ALL INFORMATION ON YOUR USB DRIVE WILL BE DELETED ::: echo. echo. set /p Disk=Please Enter USB Disk NUMBER: if "%Disk%"=="" goto :eof echo. set /p USB=Please Enter USB Disk LETTER: if "%USB%"=="" goto :eof echo. set /p DVD=Please Enter CD-ROM/DVD Disk LETTER: if "%DVD%"=="" goto :eof echo. set /p Format=Type In FAT32 (for uefi system) or NTFS (non-uefi): if "%Format%"=="" goto :eof echo. ::==============================================+ ::==CREATE DISKPART SCRIPT FILE==:: echo>>%userprofile%\desktop\Script.txt Select Disk %disk% echo>>%userprofile%\desktop\Script.txt Clean echo>>%userprofile%\desktop\Script.txt Create Partition Primary echo>>%userprofile%\desktop\Script.txt Select Partition 1 echo>>%userprofile%\desktop\Script.txt Active echo>>%userprofile%\desktop\Script.txt FORMAT FS=%format% label="OS" quick echo>>%userprofile%\desktop\Script.txt Assign letter=%usb% noerr echo>>%userprofile%\desktop\Script.txt End ::==============================================+ ::==CREATE INSTALLER BATCH SCRIPT==:: set del=del/f/q %homepath%\desktop\ echo>>%userprofile%\desktop\USB.Format.Tool.bat @echo off echo>>%userprofile%\desktop\USB.Format.Tool.bat color e echo>>%userprofile%\desktop\USB.Format.Tool.bat title, Windows Bootable USB echo>>%userprofile%\desktop\USB.Format.Tool.bat DiskPart.exe /s Script.txt echo>>%userprofile%\desktop\USB.Format.Tool.bat echo. echo>>%userprofile%\desktop\USB.Format.Tool.bat echo. echo>>%userprofile%\desktop\USB.Format.Tool.bat cls echo>>%userprofile%\desktop\USB.Format.Tool.bat echo +=================================================+ echo>>%userprofile%\desktop\USB.Format.Tool.bat echo + Creating a Bootable USB Flash Drive. + echo>>%userprofile%\desktop\USB.Format.Tool.bat echo +=================================================+ echo>>%userprofile%\desktop\USB.Format.Tool.bat echo. echo>>%userprofile%\desktop\USB.Format.Tool.bat echo. echo>>%userprofile%\desktop\USB.Format.Tool.bat del/f/q c:%homepath%\desktop\Script.txt echo>>%userprofile%\desktop\USB.Format.Tool.bat echo. echo>>%userprofile%\desktop\USB.Format.Tool.bat echo Please wait while files or copied over... echo>>%userprofile%\desktop\USB.Format.Tool.bat set start=%%time%% echo>>%userprofile%\desktop\USB.Format.Tool.bat set finished=%%time%% echo>>%userprofile%\desktop\USB.Format.Tool.bat xcopy %dvd%:\*.* %usb%:\ /s/e/h/f/c/q echo>>%userprofile%\desktop\USB.Format.Tool.bat cls echo>>%userprofile%\desktop\USB.Format.Tool.bat for /f "tokens=1-3 delims=:." %%%%a in ("%%start%%") do ( echo>>%userprofile%\desktop\USB.Format.Tool.bat set hour=%%%%a echo>>%userprofile%\desktop\USB.Format.Tool.bat set /a minute=100%%%%b %%%% 100 echo>>%userprofile%\desktop\USB.Format.Tool.bat set /a second=100%%%%c %%%% 100 echo>>%userprofile%\desktop\USB.Format.Tool.bat ) echo>>%userprofile%\desktop\USB.Format.Tool.bat for /f "tokens=1-3 delims=:." %%%%a in ("%%finished%%") do ( echo>>%userprofile%\desktop\USB.Format.Tool.bat set hour2=%%%%a echo>>%userprofile%\desktop\USB.Format.Tool.bat set /a minute2=100%%%%b %%%% 100 echo>>%userprofile%\desktop\USB.Format.Tool.bat set /a second2=100%%%%c %%%% 100 echo>>%userprofile%\desktop\USB.Format.Tool.bat ) echo>>%userprofile%\desktop\USB.Format.Tool.bat if /i %%second2%% lss %%second%% ( echo>>%userprofile%\desktop\USB.Format.Tool.bat set /a second2+=60 echo>>%userprofile%\desktop\USB.Format.Tool.bat set /a minute2-=1 echo>>%userprofile%\desktop\USB.Format.Tool.bat ) echo>>%userprofile%\desktop\USB.Format.Tool.bat if /i %%minute2%% lss %%minute%% ( echo>>%userprofile%\desktop\USB.Format.Tool.bat set /a minute2+=60 echo>>%userprofile%\desktop\USB.Format.Tool.bat set /a hour2-=1 echo>>%userprofile%\desktop\USB.Format.Tool.bat ) echo>>%userprofile%\desktop\USB.Format.Tool.bat set /a minuted=%%minute2%%-%%minute%% echo>>%userprofile%\desktop\USB.Format.Tool.bat set /a secondd=%%second2%%-%%second%% echo>>%userprofile%\desktop\USB.Format.Tool.bat set /a secondsd=3600*%%hourd%%+60*%%minuted%%+%%secondd%% echo>>%userprofile%\desktop\USB.Format.Tool.bat cls echo>>%userprofile%\desktop\USB.Format.Tool.bat color 1f echo>>%userprofile%\desktop\USB.Format.Tool.bat echo YOUR THUMBDRIVE OS HAS COMPLETED IN: %%minuted%% minutes, and %%secondd%% seconds. echo>>%userprofile%\desktop\USB.Format.Tool.bat echo. echo>>%userprofile%\desktop\USB.Format.Tool.bat Pause echo>>%userprofile%\desktop\USB.Format.Tool.bat goto end echo>>%userprofile%\desktop\USB.Format.Tool.bat :end echo>>%userprofile%\desktop\USB.Format.Tool.bat Exit ::==============================================+ cls title ALL INSTALL FILES CREATED SUCCESSFULLY color e echo You Can Now..Dbl Click on USB.Format.Tool.bat to Install OS to USB... echo. echo Press any [KEY] to Close-Out this Screen...&&PAUSE>NUL :EOF Exit :: created 08-10-12 :: revised 02.25.14 - Added fat32 or ntfs system file types and finish time for usb os installation.
nope.. don't have a extra usb thumbdrive to do a complete install, but running from my desktop it worked just fine..
Here is another way to Runas Admin for all the non-admin users out there that like to have metro enabled etc, will show Administrator in the dos console..(tested and working on 8.1) DP Code: @set @jscript=1/* @echo off&color a @cd /d "%~dp0" :: ### ADMIN CHECK.. reg query "hku\S-1-5-19" >nul 2>&1 || ( @cscript //e:jscript //nologo "%~f0" "%~f0" goto :eof ) < !PUT BATCH CODE HERE! > :eof // ### RUN AS ADMIN.. */ var strArg = WScript.Arguments(0); var objSH = WScript.CreateObject("Shell.Application"); objSH.ShellExecute(strArg, "", "", "runas", "5");