Web Hosting Talk







View Full Version : DOS Question


fatbargains
09-13-2002, 04:09 PM
I have a file called file.bat on my computer. When the user clicks on it, i want it to capture the user's login name (NT) and store in a variable (i.e., $username would replace with the real username of that user). What variable/code do i put into the this bat file? Someone told me this can be done. I'm clueless about DOS, so please help me out.

bitserve
09-14-2002, 12:15 PM
When I type "set" in my "Command Prompt", it shows:

USERNAME=Administrator

That's probably the environment variable you're looking for. To use it in a BAT file, just put percent signs around it:

%USERNAME%

To set a variable use:

set MYVAR=%USERNAME%