General discussion

Locked

NT Shell Scripting

By dbedford ·
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.

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

NT Shell Scripting

by Mike Jones In reply to NT Shell Scripting

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.

Collapse -

NT Shell Scripting

by Mike Jones In reply to NT Shell Scripting

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.

Collapse -

NT Shell Scripting

by dbedford In reply to NT Shell Scripting

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.

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Software Forums