Need a CMD guru

Soldato
Joined
1 Dec 2006
Posts
16,881
Location
Amsterdam, NL
Trying to get a simple .bat file to put the date in the title of a text doc it creates when it runs a ping bat...

So, for example I need the .bat to run test.bat (which has a huge list of ping -n 3 commands to a bunch of IP. the bat file I am trying to make, I want it to create a text file with the title for the name of the txt file.

Also, to create a new file each time the bat is run.

Thanks, ags.
 
Yea %date% is the one you want.

I have one at work which I wrote not so long ago; if I remember I'll copy it in here tomorrow if I get chance.
 
easy way is to just output the second batch file to the filename you want

test.bat
Code:
@echo off

test1.bat > %date:~6,4%%date:~3,2%%date:~0,2%test.txt

test1.bat
Code:
ping 127.0.0.1 -n 100

As to different file names per run, run it once a day? :)
 
Got it working now guys...

Setup a scheduled task on one of the servers to run a .bat which had the following in:

v:
cd 03 Engineering Team
cd server ping logs

"reading server ping.bat" > %date:~-4,4%-%date:~-7,2%-%date:~0,2%__%time:~0,2%.%time:~3,2%.%time:~6,2%.txt

Cheers for the help guys :)

ags
 
Back
Top Bottom