Windows XP Batch File with User Input question

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
VexedFist
Posts: 2
Joined: 21 May 2007 07:42
Location: Chicago
Contact:

Windows XP Batch File with User Input question

#1 Post by VexedFist » 22 May 2007 09:57

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.

VexedFist
Posts: 2
Joined: 21 May 2007 07:42
Location: Chicago
Contact:

#2 Post by VexedFist » 22 May 2007 14:51

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???

DosItHelp
Expert
Posts: 239
Joined: 18 Feb 2006 19:54

#3 Post by DosItHelp » 28 May 2007 22:40

VexedFist,

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. ;)

Post Reply