Computing.Net > Forums > Programming > user name in batch code

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

user name in batch code

Reply to Message Icon

Name: RMDan
Date: October 21, 2008 at 15:44:17 Pacific
OS: Xp
CPU/Ram: ?
Product: G
Comment:

Im making a batch file im going to put in the all ussers start folder to log what time each user logs on to my laptop. Ive got it so i can log time and date, but is it possible to log what user with a system vatriable(like the %time% and %date% functions)?

Heres my code at the moment:
@echo off
set t=%time%
set d=%date%
echo %d%-%t%>>time.txt

Going to set the date as the file name later after i figure out the user log part.

Thanks if you can help.



Sponsored Link
Ads by Google

Response Number 1
Name: Valerie (by Garibaldi)
Date: October 21, 2008 at 19:23:46 Pacific
Reply:

%username% ?


0

Response Number 2
Name: klint
Date: October 22, 2008 at 02:07:58 Pacific
Reply:

The "proper" way of doing this is to use a security audit policy. In Control Panel select Administrative Tools, then Local Security Policy. In the tree on the left, expand Local Policies and then Audit Policy. You can then turn on various audits, including Logon, but also some other events you may be interested in.

You can then view these events in the Security section of Event Viewer.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: user name in batch code

User name in DataGrid Control 6 www.computing.net/answers/programming/user-name-in-datagrid-control-6/6993.html

Nesting variables in batch files ? www.computing.net/answers/programming/nesting-variables-in-batch-files-/14334.html

Compare file names in batch file www.computing.net/answers/programming/compare-file-names-in-batch-file/16616.html