If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Batch files in Win XP
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. |
Ads |
#2
|
|||
|
|||
Batch files in Win XP
On 18 May 2007 07:37:12 -0700, VexedFist wrote:
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 |
#3
|
|||
|
|||
Batch files in Win XP
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 Dataif "" == "" goto error you ,ust specify a number on the command line C:\Temp Data Files\Raw Datapause On May 18, 10:16 am, John Hensley wrote: On 18 May 2007 07:37:12 -0700, VexedFist wrote: 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 Hensleywww.resqware.com- Hide quoted text - - Show quoted text - |
#4
|
|||
|
|||
Batch files in Win XP
|
#5
|
|||
|
|||
Batch files in Win XP
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 |
Thread Tools | |
Display Modes | |
|
|