Jump to content

Recommended Posts

Posted (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 = Exit

echo.

: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 script

After this there must come something like

goto choice

:MeerInfo

%systemdrive%\Drivers\MeerInfo.txt

goto choice

:ATi

%systemdrive%\Drivers\ati.exe

goto choice

:NVidia

%systemdrive%\Drivers\nvidia.exe

goto choice

:Exit

EXIT

Now 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!! :rolleyes::yes::lol::w00t:

Edited by Raoul90

Posted
f "%C%"=="1" goto MeerInfo.txt

if "%C%"=="2" goto ati.exe

if "%C%"=="3" goto nvidia.exe

if "%C%"=="4" goto exit script

Should be:

f "%C%"=="1" goto :MeerInfo.txt

if "%C%"=="2" goto :ATi

if "%C%"=="3" goto :NVidia

if "%C%"=="4" goto :EOF

And then, this:

goto choice

:MeerInfo

%systemdrive%\Drivers\MeerInfo.txt

goto choice

:ATi

%systemdrive%\Drivers\ati.exe

goto choice

:NVidia

%systemdrive%\Drivers\nvidia.exe

goto choice

:Exit

EXIT

Should be:

GOTO :choice

:MeerInfo

MORE %systemdrive%\Drivers\MeerInfo.txt

GOTO :choice

:ATi

START /W "" "%systemdrive%\Drivers\ati.exe"

GOTO :choice

:NVidia

START /W "" "%systemdrive%\Drivers\nvidia.exe"

GOTO :choice

(read here):

http://www.ss64.com/nt/start.html

http://www.ss64.com/nt/more.html

but 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 :choice

if "%C%"=="3" START /W "" "%systemdrive%\Drivers\nvidia.exe"&goto :choice

if "%C%"=="4" goto :EOF

jaclaz

Posted (edited)

Okay thanks!

Got it working, but

When 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 by Raoul90
Posted
Okay thanks!

Got it working, but

When 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

Posted

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?

Posted

Here try this, you might have to adjust the paths.

@Echo Off

Set Driver=%SystemDrive%\Drivers

IF Not Exist %Driver% Goto MissingDriver

IF Exist %Driver% Goto MainMenu

:MainMenu
CLS
Color 9E
Mode 62,14
Title Driver Install
Echo.
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 AtiDriver
IF /I '%UC%'=='NVid' GOTO NVidiaDriver
IF /I '%UC%'=='Text' GOTO ReadText
IF /I '%UC%'=='Quit' GOTO TheEnd1

:: If It Not A Correct Input
CLS
MODE 55,5
COLOR F4
TITLE Input Error
ECHO.
ECHO This was not valid ^> %UC%
ping -n 5 127.0.0.1>nul
GOTO MainMenu

:AtiDriver
Cls
Mode 62,5
Start /W %Driver%\ati.exe
Goto TheEnd1

:NVidiaDriver
Cls
Mode 62,5
Start /W %Driver%\ati.exe
Goto TheEnd1

:ReadText
Cls
Mode 62,5
Echo.
Echo Proccessing MeerInfo.txt
Start /W Notepad %Driver%\MeerInfo.txt
Goto MainMenu

:MissingDriver
CLS
Mode 62,5
Color 9a
Echo.
Echo Missing This Folder :%Driver%
Echo.
Set /P = "Can Not Install Any Drivers Press Any Key To Close.
Goto TheEnd1

:TheEnd1
Exit

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...