windows - Batch File that Makes Driver Installations Quicker -
i trying make batch file makes process of installing multiple drivers lot easier. goes through each driver 1 one, user has click "next" continuously through whole process instead of having keep track of drivers installed. here code: names of drivers in text file , uses loop go through them.
the problem first driver works fine, piece of code tells user driver has been installed , total amount thats been installed, plus ask user if want continue, not work. after first driver finishes, rest open @ same time , don't go 1 one intended. seems /wait code doesn't function anymore.
@echo off :intro echo welcome driver installation agent. echo. echo. :getinput echo enter 1 - start installing echo. echo enter 2 - exit echo. set input= set /p input=enter option: %=% if "%input%" == "1" goto installagent if "%input%" == "2" goto :eof goto invalid :installagent set /a b=0 /f "tokens=*" %%a in (driverlist.txt) start %%a goto finish :start start /s /wait %%a /norestart eula_accept=yes set /a b+=1 echo driver %a% has been installed, %b% drivers have been installed in total. echo enter 2 exit, otherwise press enter continue. set input2= set /p input2=enter option: %=% if "%input2%" == "2" goto :eof :finish echo echo updates performed. press key exit. echo pause cls :invalid echo invalid option echo. goto getinput
i know may not efficient way install drivers, has been bugging me , think way introduced coding in cmd. helpful!
next code snippet help:
:installagent set /a b=0 /f "tokens=*" %%a in (driverlist.txt) ( set "_driver=%%~a" call :start ) goto :finish :start start /s /wait %_driver% /norestart eula_accept=yes set /a b+=1 echo driver %_driver% has been installed, %b% drivers have been installed in total. set "input2=" set /p "input2=enter 2 exit, otherwise press enter continue: " if "%input2%"=="2" goto :incomplete goto :eof :invalid echo invalid option echo. goto :getinput :finish echo( echo updates performed. press key exit. echo( :incomplete pause cls
resources (required reading):
- (command reference) an a-z index of windows cmd command line
- (additional particularities) windows cmd shell command line syntax
- (
call
command) call 1 batch program another, or call subroutine - (
%~a
etc. special page) command line arguments (parameters)
Comments
Post a Comment