Batch adding adding var to output

January 12, 2009 at 09:13:31
Specs: Windows Server 2003, pentium 3 - 1gb ram
Hello all,

I have a simple logoff batch script that looks like this:

echo Last Logoff for %Username% was on: %date% at %time% > \\Server\Apps\Logs\Logoff\%Username%.txt

I need to add the date and the words "logoff" onto the filename so it does not overwrite the last file.

the output would look something like:

I tried using using:

it almost works, but the file looks like:


and the file doesnt have .txt

any help is greatly appreciated

See More: Batch adding adding var to output

Report •

January 12, 2009 at 09:29:42
figured it out

(now I just need to get it to work so that if they logon/off multiple times there is an entry for it

@echo off

echo %DATE%
set myDATE=%DATE:~7,2%%DATE:~4,2%
echo myDATE is %myDATE%
echo A Logoff entry for %Username% was created on: %myDATE% at %time% > %Username%_logoff_%myDATE%.txt

Report •
Related Solutions

Ask Question