Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: *Solved* Making a autoinstall batchfile  (Read 5169 times)

0 Members and 1 Guest are viewing this topic.

Brother_B

  • Guest
*Solved* Making a autoinstall batchfile
« on: June 07, 2007, 11:07:12 AM »
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 ?

_B
« Last Edit: June 08, 2007, 02:32:41 AM by Brother_B »

GuruGary



    Adviser
    Re: Making a autoinstall batchfile
    « Reply #1 on: June 07, 2007, 11:32:50 PM »
    You 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
    pause

    Brother_B

    • Guest
    Re: Making a autoinstall batchfile
    « Reply #2 on: June 08, 2007, 01:30:04 AM »
    I will try that.

    Thanks.

    _B

    Brother_B

    • Guest
    Re: Making a autoinstall batchfile
    « Reply #3 on: June 08, 2007, 02:29:15 AM »
    Just 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.

    contrex

    • Guest
    Re: *Solved* Making a autoinstall batchfile
    « Reply #4 on: June 08, 2007, 03:27:16 AM »
    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.

    GuruGary



      Adviser
      Re: *Solved* Making a autoinstall batchfile
      « Reply #5 on: June 08, 2007, 04:34:55 PM »
      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?