PDA

View Full Version : Get User ID on Windows


member887
12-11-2008, 11:11 PM
Hi -

On Linux/Unix, there is a function called getuid() that will retrieve the user id information of the calling process. Is there an equivalent function on Windows?

Thanks,
member887

Spookster
12-12-2008, 01:01 AM
You can access the Windows environment variable %USERNAME%. You didn't mention how you want to access it though. Batch file? Command Prompt? C/C++? With C/C++ you can use the getenv() function to retrieve specific environment variable values.