Batch files in Win XP

V

VexedFist

I am trying to write a bath file for use in Windows XP.
Here is what I have now:

CD\
CD..
cd Temp Data Files
cd Raw Data
del lexall
del lexall.out
rename lexall.txt lexall.
9005LEX.EXE

I need to change the lexall.txt file name to include a user variable:

1234567_lexall.txt

The Number 1234567 needs to be input by the user every time.
Does anybody have any ideas?

Any and all suggstions will be welcome.
 
J

John Hensley

I am trying to write a bath file for use in Windows XP.
Here is what I have now:

CD\
CD..
cd Temp Data Files
cd Raw Data
del lexall
del lexall.out
rename lexall.txt lexall.
9005LEX.EXE

I need to change the lexall.txt file name to include a user variable:

1234567_lexall.txt

The Number 1234567 needs to be input by the user every time.
Does anybody have any ideas?

Any and all suggstions will be welcome.

Here is an example of a batch file that should do what want. You need
to specify the number on the command line such as "MyBatchFile 12345".
If the user doesn't pass anything on the command line it will display
an error message.

if "%1"=="" goto error
cd "\Temp Data Files\Raw Data"
del lexall
del lexall.out
ren lexall.txt %1_lexall
9005LEX.EXE
@goto end
:error
@echo You must specify a number on the command line
:end


John Hensley
www.resqware.com
 
V

VexedFist

This just opens and closes the window too fast to see.
If I added a pause (see below):

if "%1"=="" goto error
pause
cd "\Temp Data Files\Raw Data"
del lexall
del lexall.out
ren lexall.txt %1_lexall
9005LEX.EXE
@goto end
:error
@echo You must specify a number on the command line
pause
:end
echo off

This is what shows in the cmd window:

C:\Temp Data Files\Raw Data>if "" == "" goto error
you ,ust specify a number on the command line

C:\Temp Data Files\Raw Data>pause
 
G

Guest

POP,

This batch file worked previously with just the "lexall.txt" file name.
However we are upgrading our reprorting now.
Our reports generate with the "Company Number" followed by an "Undescore"
and then the "lexall.txt" file name.
(i.e., if a company has a number of 3456888 then the report is called
3456888_lexall.txt).

We need to strip the (Company Number and Underscore, as well as the file
suffix [.txt]) before starting the 9005LEX.EXE program.

The 9005LEX.EXE program requires the input file (to be name lexall, with no
file type) to run correctly.

Pop all this batch file needs to do is rename a file and run the 9005LEX.EXE
program
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top