Raoul90 Posted November 28, 2008 Share Posted November 28, 2008 (edited) Hey,Im trying to make a batchscript to install some drivers.@echo off CLS:menu echo. echo. echo. echo. echo Wilt u drivers installeren of niet? echo. echo 1 = Meer informatie echo 2 = ATi echo 3 = NVidia echo 4 = Exitecho. :choice set /P C=[1,2,3,4]? if "%C%"=="1" goto MeerInfo.txt if "%C%"=="2" goto ati.exe if "%C%"=="3" goto nvidia.exe if "%C%"=="4" goto exit scriptAfter this there must come something likegoto choice:MeerInfo%systemdrive%\Drivers\MeerInfo.txt goto choice:ATi%systemdrive%\Drivers\ati.exegoto choice:NVidia%systemdrive%\Drivers\nvidia.exegoto choice:ExitEXITNow i have a map called "Drivers" @ %systemdrive%1 has to call up a txt file called MeerInfo.txt its in the "Drivers" directory @ %systemdrive%.2 has to call up the ati.exe (ati drivers), this is also in the "Drivers" directory @ %systemdrive%.3 has to call up the nvidia.exe (nvidia drivers), this one is also in the "Drivers" directory @ %systemdrive%. 4 has to call nothing and just exit the script.Can someone help me with this.Thanks in advance!! Edited November 28, 2008 by Raoul90 Link to comment Share on other sites More sharing options...
jaclaz Posted November 28, 2008 Share Posted November 28, 2008 f "%C%"=="1" goto MeerInfo.txt if "%C%"=="2" goto ati.exe if "%C%"=="3" goto nvidia.exe if "%C%"=="4" goto exit scriptShould be:f "%C%"=="1" goto :MeerInfo.txt if "%C%"=="2" goto :ATi if "%C%"=="3" goto :NVidia if "%C%"=="4" goto :EOFAnd then, this:goto choice:MeerInfo%systemdrive%\Drivers\MeerInfo.txt goto choice:ATi%systemdrive%\Drivers\ati.exegoto choice:NVidia%systemdrive%\Drivers\nvidia.exegoto choice:ExitEXITShould be:GOTO :choice:MeerInfoMORE %systemdrive%\Drivers\MeerInfo.txt GOTO :choice:ATiSTART /W "" "%systemdrive%\Drivers\ati.exe"GOTO :choice:NVidiaSTART /W "" "%systemdrive%\Drivers\nvidia.exe"GOTO :choice(read here):http://www.ss64.com/nt/start.htmlhttp://www.ss64.com/nt/more.htmlbut you can simplify it by simply using:f "%C%"=="1" MORE %systemdrive%\Drivers\MeerInfo.txt&goto :choice if "%C%"=="2" START /W "" "%systemdrive%\Drivers\ati.exe"&goto :choiceif "%C%"=="3" START /W "" "%systemdrive%\Drivers\nvidia.exe"&goto :choiceif "%C%"=="4" goto :EOFjaclaz Link to comment Share on other sites More sharing options...
Raoul90 Posted November 28, 2008 Author Share Posted November 28, 2008 (edited) Okay thanks!Got it working, butWhen i push start it opens the txt in the cmd? How can i open it with notepad?I should call %SystemRoot%\system32\notepad.exe first then?When i say:NOTEPAD.EXE "" "C:\%systemdrive%\MeerInfo.txt"Notepad say it cant find a .txt file, also MeerInfo without .txt wont work?? Edited November 28, 2008 by Raoul90 Link to comment Share on other sites More sharing options...
jaclaz Posted November 28, 2008 Share Posted November 28, 2008 Okay thanks!Got it working, butWhen i push start it opens the txt in the cmd? How can i open it with notepad?I should call %SystemRoot%\system32\notepad.exe first then?I didn't get you wanted to use Notepad, yes , you should use START /W "" "%SystemRoot%\system32\notepad.exe" "%systemdrive%\Drivers\MeerInfo.txt"jaclaz Link to comment Share on other sites More sharing options...
Raoul90 Posted November 28, 2008 Author Share Posted November 28, 2008 w00t it works! Thank you sir!! :D Link to comment Share on other sites More sharing options...
Raoul90 Posted November 28, 2008 Author Share Posted November 28, 2008 One more question.When they push 2 for ATi, and the installation is finished, with what command will the batch exit itself then? So there isnt a possibility to install ATi and NVidia, just one. After installation, the batch should close itself? Link to comment Share on other sites More sharing options...
gunsmokingman Posted November 29, 2008 Share Posted November 29, 2008 Here try this, you might have to adjust the paths.@Echo OffSet Driver=%SystemDrive%\DriversIF Not Exist %Driver% Goto MissingDriverIF Exist %Driver% Goto MainMenu:MainMenuCLSColor 9EMode 62,14Title Driver InstallEcho.ECHO ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»ECHO ºÄÄÄÄÄÄÄÄÄÄÄÄÄ Ati Display Drivers ÄÄÄÄÄÄÄÄÄÄÄĺECHO ºÄ TYPE: Ati To Install Ati Display Driver ĺ ECHO ºÄÄÄÄÄÄÄÄÄÄÄÄ NVidia Display Drivers ÄÄÄÄÄÄÄÄÄÄĺECHO ºÄ TYPE: NVid To Install NVidia Display Driver ĺ ECHO ºÄÄÄÄÄÄÄÄÄÄÄÄ Read MeerInfo Text ÄÄÄÄÄÄÄÄÄÄĺECHO ºÄ TYPE: Text To Read The MeerInfo Text ĺ ECHO ºÄÄÄÄÄÄÄÄÄÄÄÄ Exit Driver Install ÄÄÄÄÄÄÄÄÄÄĺECHO ºÄ TYPE: Quit To Exit This Program ĺ ECHO ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼECHO.SET UC=SET /P UC=Type In Your Reply Then Press Enter ^> IF /I '%UC%'=='Ati' GOTO AtiDriverIF /I '%UC%'=='NVid' GOTO NVidiaDriverIF /I '%UC%'=='Text' GOTO ReadTextIF /I '%UC%'=='Quit' GOTO TheEnd1:: If It Not A Correct InputCLSMODE 55,5COLOR F4TITLE Input ErrorECHO.ECHO This was not valid ^> %UC%ping -n 5 127.0.0.1>nulGOTO MainMenu:AtiDriverClsMode 62,5Start /W %Driver%\ati.exeGoto TheEnd1:NVidiaDriverClsMode 62,5Start /W %Driver%\ati.exeGoto TheEnd1:ReadTextClsMode 62,5Echo.Echo Proccessing MeerInfo.txtStart /W Notepad %Driver%\MeerInfo.txtGoto MainMenu:MissingDriverCLSMode 62,5Color 9aEcho.Echo Missing This Folder :%Driver%Echo.Set /P = "Can Not Install Any Drivers Press Any Key To Close.Goto TheEnd1:TheEnd1Exit Link to comment Share on other sites More sharing options...
Raoul90 Posted November 29, 2008 Author Share Posted November 29, 2008 Thanks m8!Works perfect after i edited couple of things Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now