Discussion Locked

NT Shell Scripting

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Was wondering if there was a guru out there that might be able to show me how to create a simple batch file that will kick of an .exe file that includes the previous days date.

We have a exe file that needs to run every morning that extracts datafrom our POS system for the previous days data.

Example:
jrn2asc.exe 1 bml 012903 Y
jrn2asc.exe 2 bmn 012903 Y

Just need to create something similar to this except it will automatically put in the prevous days date.

Does that make sense? Thanks.

3 replies

by mike jones

Must be in a batch file.

for /F "tokens=1-4 delims=/" %a in ('DATE/T') do jrn2asc.exe 1 bml %%a%%b%%c Y

Will produce

jrn2asc.exe 1 blm ddmmyyyy y

using the current date in ddmmyyyy format, I can't work how to get it include the previousdate just yet, but I will.

by mike jones

or you could run the following just before midnight using the NT scheduler

for /F "tokens=1-4 delims=/" %a in ('DATE/T') do echo jrn2asc.exe 1 bml %%a%%b%%c Y > test.bat

This will create a test.bat which you can then run in the morning.

by dbedford

Hey Mike..Thanks. I'm almost there. When I run the command line per your suggestion.

for /F "tokens=1-4 delims=/" %a in ('DATE/T') do echo jrn2asc.exe 1 bml %a%b%c Y > test.bat

It creates the test.bat file..perfect. Now, when I edit the bat file it reads..
jrn2asc.exe 1 bml Tue 03042003 Y

The problem with the output is it will not run with "Tue", Or the full Year "2003" needs to be 03, and the Y has 2 spaces after the date. Out put needs to look like this.

jrn2asc.exe 1 bml 030403 Y

Can you help again. Thanks sooo much.

This discussion is closed to new replies.