mmainio Posted June 13, 2004 Share Posted June 13, 2004 Hello, How can I pick currently logged-in-user and use that as variable in my batch file?I wanted to copy some files into c:\my documents\user X\some folder but the problem in path is that "user X".Is there easy way to "read" that and use variable for it?MMainio Link to comment Share on other sites More sharing options...
DarkPhoenix Posted June 13, 2004 Share Posted June 13, 2004 In Windows XP at least, you have the following variables:%Userprofile% = "X:\Documents And Settings\Username".. if you have windows installed on C and the user name is Cow, then it'll return "C:\Documents And Settings\Cow"%Username%="Username".. would just return "Cow" (I think this is the one you want)These assume you have WinXP though.. I don't use other systems, so I can't help you otherwise. Link to comment Share on other sites More sharing options...
<SparTacuS> Posted June 13, 2004 Share Posted June 13, 2004 Following on from DarkPhoenix's post;If you open a console (DOS) window and type "set" you will see a list of all the variables and their current values.To use these in your batch file enclose them in "% %" symbols as you can see in DarkPhoenix's examples. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now