Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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:
logoff_username_date.txtI tried using using:
logoff_%Username%_%date%.txtit almost works, but the file looks like:
"logoff_user001_Mon"
and the file doesnt have .txt
any help is greatly appreciated
thanks
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 Offensive Follow Up For Removal
![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |