|
Answer» Hello everyone.
I'm making a INSTALL cd with a bunch of drivers for my computer.
How can i make a check that i have installed a driver, so if the computer restarts i don't have to install all of the allready installed drivers.
is it possible to write and read from a txt file ?
like: install driver 1, write 1 to the textfile. install driver 2, write 2 to the textfile
when i start the bat file, it will read from the textfile if no textfile is found, install from driver 1. If it FINDS the textfile and it reads 2 from the textfile begin installing fom driver 3.
Do you understand my question, and if so, can you help me ?
_BYou could do something like: Code: [Select]@echo off setlocal set NextDriverLog=C:\NextDriverLog.txt if not exist %NextDriverLog% GOTO :Driver1 set /p NextDriver=<%NextDriverLog% goto :%NextDriver% :Driver01 \Driver01\setup.exe if not ERRORLEVEL 1 echo Driver02>NextDriverLog :Driver02 \Driver02\setup.exe if not errorlevel 1 echo Driver03>NextDriverLog :Driver03 \Driver03\setup.exe if not errorlevel 1 echo Driver04>NextDriverLog :Driver04 \Driver04\setup.exe if not errorlevel 1 echo Driver05>NextDriverLog :Driver05 \Driver05\setup.exe if not errorlevel 1 echo Done>NextDriverLog :Done echo Done pauseI will try that.
Thanks.
_BJust had to change this line "if not errorlevel 1 echo Driver02>NextDriverLog" To this "if not errorlevel 1 echo Driver02>%NextDriverLog%"
Then it worked fine.
Thanks a bunch.Just a point: That is what happens, often, if you use similar names for variables and for files. You end up forgetting quotes or % signs. Yeah, SOMETIMES I think I am good enough to post code without testing it ... but if it is more than a line or 2 it usually isn't perfect. Or maybe I do it on purpose to give the poster something to work on so they can learn instead of just copying code?
|