Need to launch BIOS update files

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
rfdr81
Posts: 25
Joined: 26 Mar 2013 04:29

Need to launch BIOS update files

#1 Post by rfdr81 » 26 Mar 2013 04:39

Hello, need some help please. I need to creat( if possible) one batch that permit to make a search and execute the file that i searched for. Example I have several bios updates from several models, for example: I have PSTA2, PTA2E, PDVX3(inside of each folder there is the bios .exe. So the idea is to creat a batch file and we execute it ask to input the model to search. we put PSTA2 for example ask for confirmation and execute the update bios.

Can anybody help me on this task?

Thanks

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Need help to creat a specific batch file

#2 Post by foxidrive » 26 Mar 2013 04:52

Untested:

Code: Select all

@echo off
set "file="
set /p "file=Enter the filename [without .exe]: "
if defined file (
for /f "delims=" %%a in ('dir "%file%.exe" /a-d /b /s') do "%%a"
)

rfdr81
Posts: 25
Joined: 26 Mar 2013 04:29

Re: Need help to creat a specific batch file

#3 Post by rfdr81 » 26 Mar 2013 05:10

Thanks for the help foxidrive

Ok, to put the name(PSTA2, etc) works fine. I have a doubt: each PST2,PST3X,etc is a folder and inside of each there is the correct bios.exe file

the commands that you program do this? When i write "PST2" will open the folder respective and run automatically the bios.exe?The same for all folders and bios.exe... And ai want to put all folders in a main folder because ia have bios from different manufactures. I have the root of the pen and the a main folfer withe the name of manufacturer(toshiba for example) and inside folder toshiba the folder with each model(PSAT2,PSA3X,etc..)

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Need help to creat a specific batch file

#4 Post by foxidrive » 26 Mar 2013 05:29

Put it in the main folder and run it.

You type the exe file name without the exe on it and it will run it, if it is a unique name.

If you want something else then explain further.

rfdr81
Posts: 25
Joined: 26 Mar 2013 04:29

Re: Need help to creat a specific batch file

#5 Post by rfdr81 » 26 Mar 2013 06:08

Again thanks, ok tha basic idea is there, but i´ll try to better explain what i need. For example let´s go for Toshiba. I have several models(PSAT2,PSAT3,PSAXL, etc...) In many cases the differents models(PSAT2,PSAT3,PSAXL, etc...) uses the same file to update the bios. So the idea is: i want to put a search line where i put the model name(PSAT2,PSAT3,PSAXL, etc...) in a way that e runs the write file tu make the update.
Eaxample: PSAT2,PSAT3,PSAXL, use the same bios file to update(let´s call bios.exe). When i put in the search line PSAT2 runs the bios.exe, if i put PSAT3 runs the same bios.exe .

But to do this i need a way to "say" that file, bios.exe, gives to PSAT2,PSAT3,PSAXL because is the same.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Need help to creat a specific batch file

#6 Post by foxidrive » 26 Mar 2013 06:21

It would depend on your folder structure and how many exe files are in each directory.

Or you could create a file that maps the correct BIOS file to the correct model: for example:

===[file starts here]===
PSAT2|c:\bios\toshiba\psat2\bios.exe
PSAT3|c:\bios\toshiba\psat2\bios.exe
PSAXL|c:\bios\toshiba\psat2\bios.exe
PS123|c:\bios\toshiba\ps123\biosABC.exe
EP45-UD3R|c:\bios\Gigabyte\EP45\bios12.exe

and with that one can easily use a batch file to run the correct BIOS file.

rfdr81
Posts: 25
Joined: 26 Mar 2013 04:29

Re: Need help to creat a specific batch file

#7 Post by rfdr81 » 26 Mar 2013 06:39

ill try to show what i want in practice: This will be my first menu i´ll run on a usb flash disk that i already have configured and is working) MENU
MENU ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
MENU º UTILS
MENU ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
MENU º 1. TOSH - BIOS
MENU º 2. HP - BIOS


So when i press option 1, enter to the line(that you first give me) to put the model name(PSAT2, etc) goes to the correct bios file.
I create on the root the pen a folder "biostosh" and inside this folder i want to put the bios files for each model. The option you give creating file map i think is a good solution.
So what is the "final structure of the batch file?
@echo off
set "file="
set /p "file=PA Number:
if defined file (
for /f "delims=" %%a in ('dir "%file%.exe" /a-d /b /s') do "%%a

How can i use this lines of command to join to this above?

PSAT2|c:\bios\toshiba\psat2\bios.exe
PSAT3|c:\bios\toshiba\psat2\bios.exe
PSAXL|c:\bios\toshiba\psat2\bios.exe
PS123|c:\bios\toshiba\ps123\biosABC.exe
EP45-UD3R|c:\bios\Gigabyte\EP45\bios12.exe

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Need help to creat a specific batch file

#8 Post by foxidrive » 26 Mar 2013 06:59

rfdr81 wrote:How can i use this lines of command to join to this above?

PSAT2|c:\bios\toshiba\psat2\bios.exe
PSAT3|c:\bios\toshiba\psat2\bios.exe
PSAXL|c:\bios\toshiba\psat2\bios.exe
PS123|c:\bios\toshiba\ps123\biosABC.exe
EP45-UD3R|c:\bios\Gigabyte\EP45\bios12.exe


With this you would have to know the model number that you need - it would search the file for the model number and then execute the BIOS file.
If you did not enter a PA number then it would quit.

Code: Select all

@echo off
set "pa="
set /p "pa=PA Number: "
if defined pa (
for /f "tokens=1,* delims=|" %%a in (file.txt) do (
if /i "%%a"=="%pa%" "%%b"
))


rfdr81
Posts: 25
Joined: 26 Mar 2013 04:29

Re: Need help to creat a specific batch file

#9 Post by rfdr81 » 26 Mar 2013 07:03

Thanks for all the help and tips. I will try to put to work :)

Thanks

rfdr81
Posts: 25
Joined: 26 Mar 2013 04:29

Re: Need help to creat a specific batch file

#10 Post by rfdr81 » 26 Mar 2013 07:52

can you please tell me waht to put on the .txt file ?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Need help to creat a specific batch file

#11 Post by foxidrive » 26 Mar 2013 08:25

you mean the file.txt ?

I gave you some examples - can you explain what more you need to know?

The format is:

modelnumber
|drive:\path\biosfile.exe

rfdr81
Posts: 25
Joined: 26 Mar 2013 04:29

Re: Need help to creat a specific batch file

#12 Post by rfdr81 » 26 Mar 2013 08:42

I made a litle test, put this in the txt file:

PSAT2|f:\biostosh\psat2\Pflash.exe f:\is the usb pen

I suceed to put the PA number, but when go Enter key gives an error, syntax error, bad variable specification

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Need help to creat a specific batch file

#13 Post by foxidrive » 26 Mar 2013 08:59

rfdr81 wrote:I made a litle test, put this in the txt file:

PSAT2|f:\biostosh\psat2\Pflash.exe f:\is the usb pen

I suceed to put the PA number, but when go Enter key gives an error, syntax error, bad variable specification


I put this in file.txt

PSAT2|f:\biostosh\psat2\Pflash.exe

and I used this code, which only echos the path to the bios:

Code: Select all

@echo off
set "pa="
set /p "pa=PA Number: "
if defined pa (
for /f "tokens=1,* delims=|" %%a in (file.txt) do (
if /i "%%a"=="%pa%" echo "%%b"
))
pause


and I got this: it works here.

PA Number: psat2
"f:\biostosh\psat2\Pflash.exe"
Press any key to continue . . .


Try it with the above, and then remove the 'echo' to enable launching the exe file.

rfdr81
Posts: 25
Joined: 26 Mar 2013 04:29

Re: Need help to creat a specific batch file

#14 Post by rfdr81 » 26 Mar 2013 09:32

i dont know what im doing wrong, put everything like you tested but gives me:

PA Number: psat2
Syntax error
bad variable specification
bad command or file name - "))".
press any key to continue

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Need help to creat a specific batch file

#15 Post by foxidrive » 26 Mar 2013 12:50

What version of Windows are you running?

Did you copy and paste the code?

Post Reply