Embed computerName and date within a file name

Hi,

How do I embed Computer Name as well as Date within file name from command prompt of Windows?

Thanks.
As for the Computer name, %ComputerName% works fine.

Does know how to embed date and time?

Thanks.
try $echo %date% at command prompt
echo "%DATE:/=_%"
or
for /f "tokens=1-3 delims=/" %i in ("%DATE%") do echo %i_%j_%k

Regards
@simeonz: Your suggestion works. Thanks for the idea.

Although, I made it work another way (almost similar to yours):

1
2
3
4
set dd=%date:~0,2%
set mm=%date:~3,2%
set yy=%date:~6,4%
run.exe > filename_%dd%%mm%%yy%.txt
Topic archived. No new replies allowed.