I am trying to write a batch file for use in Windows XP.
Here is the current Batch file (9005.bat) I need to modify:
CD\
CD..
cd Temp Data Files
cd Raw Data
del LEXALL
del LEXALL.out
rename LEXALL.txt LEXALL.
9005LEX.EXE
We have re-written our download programs to add a number in-front of the file name (i.e. LEXALL is now: 1234567_LEXALL.txt). since we run this Batch file for multiple reports.
I need to rename this file from: 1234567_lexall.txt to lexall.
since the number changes with each report, it should be a user input for the variable:
The Number 1234567 (Variable) will need to be input every time the program runs (as the number will be different.
Does anybody have any ideas?
Any and all suggstions will be welcome.
Windows XP Batch File with User Input question
Moderator: DosItHelp
well, here is what I figured out by myself. It is probabky not the best way, however...
set CmrNum=
set varb2=_lexall.txt
cd "C:\Temp Data Files\Raw Data"
set /p CmrNum=Enter the Cmr Number:
set line= CmrNum varb2.
call set line=%CmrNum%%varb2%
echo.%line%
REM echo.%line%>>usernames.txt
del lexall
del lexall.out
rename %line% lexall.
9005LEX.EXE
echo off
If anyone has any better ideas, I would appreciate them.
The 9005LEX.EXE program requires that you hit the Y Key to continue.
I don't know if there is a way to start the 9005LEX.EXE program and automatically send the Y?
Anyone have any ideas???
set CmrNum=
set varb2=_lexall.txt
cd "C:\Temp Data Files\Raw Data"
set /p CmrNum=Enter the Cmr Number:
set line= CmrNum varb2.
call set line=%CmrNum%%varb2%
echo.%line%
REM echo.%line%>>usernames.txt
del lexall
del lexall.out
rename %line% lexall.
9005LEX.EXE
echo off
If anyone has any better ideas, I would appreciate them.
The 9005LEX.EXE program requires that you hit the Y Key to continue.
I don't know if there is a way to start the 9005LEX.EXE program and automatically send the Y?
Anyone have any ideas???
VexedFist,
Your approach looks fine, I just compressed it a little:
Hope this helps.
Your approach looks fine, I just compressed it a little:
Code: Select all
cd "C:\Temp Data Files\Raw Data"
set "CmrNum="
set /p "CmrNum=Enter the Cmr Number: "
del lexall
del lexall.out
rem echo.rename "%CmrNum%_lexall.txt" "lexall"
rename "%CmrNum%_lexall.txt" "lexall"
9005LEX.EXE
Hope this helps.