need help writing simple DOS batch file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
mikecarter79
Posts: 2
Joined: 26 Jun 2012 17:29

need help writing simple DOS batch file

#1 Post by mikecarter79 » 26 Jun 2012 17:35

Hello,

I have not messed around with DOS batch files in many years, and I need a simple program that will write the proper firmware to 1 of 3 different types of WD hard drives. The batch file only has to query the user for the hard drive type. Let's call the hard drive types A, B or C. Once the user inputs the hard drive type, an exec program will execute using the proper firmware for that particular drive type. Finally, a second exec file will execute for all 3 hard drive cases.

Here is what I need in laymens terms:

----------------------------------------------------------------------------

query user : are you updating firmware on WD hard drive type A, B or C : (HDtype)

VAR = HDtype

if VAR = A then execute (WD_download.exe 1tb.bin)
else
if VAR = B then execute (WD_download.exe 250_500.bin)
else
if VAR = C then execute (WD_download.exe velociraptor.bin)

endif

wdsspd.exe -a


----------------------------------------------------------------------------

Thanks in advance for your help !!!! :mrgreen:

-Mike

Fawers
Posts: 187
Joined: 08 Apr 2012 17:11
Contact:

Re: need help writing simple DOS batch file

#2 Post by Fawers » 26 Jun 2012 18:39

This should do it:

Code: Select all

@echo off

:menu
set "hdType="
set /p "hdType=Are you updating firmware on WD Hard Drive type 'A', 'B' or 'C'? "
if /i "%hdType%" == "A" (start /wait WD_download.exe 1tb.bin&goto ok)
if /i "%hdType%" == "B" (start /wait WD_download.exe 250_500.bin&goto ok)
if /i "%hdType%" == "C" (start /wait WD_download.exe velociraptor.bin&goto ok)
cls
echo Invalid input!
echo Please try again.
echo,
goto menu

:ok
start wdsspd.exe -a

mikecarter79
Posts: 2
Joined: 26 Jun 2012 17:29

Re: need help writing simple DOS batch file

#3 Post by mikecarter79 » 26 Jun 2012 19:03

Fawers,

Thanks a million for the quick reply and code !!

:D

Fawers
Posts: 187
Joined: 08 Apr 2012 17:11
Contact:

Re: need help writing simple DOS batch file

#4 Post by Fawers » 26 Jun 2012 21:22

mikecarter79 wrote:Fawers,

Thanks a million for the quick reply and code !!

:D

No problem! Come back whenever you want and/or need to.

PS: I might be wrong, but is the syntax you used to explain, the JavaScript syntax? :roll:

Post Reply