1.

Solve : Inserting System Date into my Call?

Answer»

I have a batch file that I need to specify the current system day and year, but I am unsure how:


@echo off

date /t > log

time /t >> log

c:

cd \

c:\protected_files\programs\pbvcon.exe MOVE_CALENDAR MGW00907 "MG_TEST" thorne cole55 MONTH Completed (need the system date to populate here)2005/05



Any help would be greatly appreciated, this is all kind of new to me. Thanks!This example will parse the date:
Code: [Select]
for /f "tokens=1-4 delims=/ " %%i in ('date /t') do (
set mm=%%j
set dd=%%k
set yy=%%l
)


Once you have the variables you can do anything you need.

Hope this helps.

Note: I gave this example to a PREVIOUS poster which resulted in EMBEDDED spaces. Use any other editor except Notepad. Seems Notepad does not save the file correctly, at least on XP anyway.That worked perfectly. I did have some TROUBLE with extra spaces when using UltraEdit (text-editor on steroids), I switched over to the CMD edit screen and it work fine.

Thanks again.



Discussion

No Comment Found