I have another batch file I am trying to get working. All I am really trying to do is check a version on a flash drive then update it to the latest version. For some reason it closes before hitting the pause. I have the pause in there to help trouble shoot. Any suggestions?
cls
@echo off
cd sbusb
@echo ----- This is not ready to be used Please close by using RED X ------
@echo.
@echo What drive letter is your flash drive?
set /p dr=
copy %dr%:\version.txt H:\ITM03\Programs\BootDisk\
type version.txt> %ver%
pause
if '%ver%'=='378' goto 379
if '%ver%'=='379' goto 380
if '%ver%'=='380' goto 381
if '%ver%'=='381' goto 382
if '%ver%'=='382' goto 383
if '%ver%'=='383' goto 384
if '%ver%'=='384' goto 385
if '%ver%'=='385' goto 386
if '%ver%'=='386' goto 387
if '%ver%'=='387' goto 388
if '%ver%'=='388' goto 389
if '%ver%'=='389' goto end
:378
:379
and so on
Another issue
Moderator: DosItHelp
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
jreat wrote:what does the %%a mean / do?
http://ss64.com/nt/for.html
It doesn't work -- it just continues on but doesn't do what you want.So I just removed the % signs and it works.
No, it's not setting a variable. It's redirecting the output of the type command into a file called "ver".The type is setting ver. Or at least seems to be.
type version.txt> ver
You probably have to add the drive letter to make it work:
Code: Select all
for /f %%a in (%dr%:\version.txt) do set "ver=%%a"
To see what ver gets set to you can:
echo %ver%
If it's not working, you can remove the @echo off and perhaps see more of what's happening. Otherwise you may have to post your version.txt file to see if it's the problem.