intergage Posted October 6, 2008 Posted October 6, 2008 Hey, I'm pretty new here. I'm just looking for a little help with a batch file my boss wants. When we upgrade networks we need to copy a bunch of stuff off (Address book, Inbox, Etc..) I made a simple copy batch but they got sick of the drive letter changing, so I said I would try and make one where it would ask you for the drive letter before it starts copying so they didn't have to edit the file on each computer. I need help with the 'set' command. I have never used it before and I'm completely clueless as to how it works. I need just a little bit of code that will ask for user input, something like; "What is the drive letter? :" kinda thing. So, I can call back on the variable through out the code rather then "E:\" I can use "Variable_name:\" kinda thing. Thanks in advanced. Quote
Sparda Posted October 6, 2008 Posted October 6, 2008 set /? will give you every thing you need. Quote
sablefoxx Posted October 6, 2008 Posted October 6, 2008 Use something like this, it may need a little modding: set /p drive= Enter drive letter: xcopy C:\files %drive%:\ %drive% will change based on the user's input, but be careful because you cannot use %drive% in "" example of what would NOT work: xcopy C:\file "%drive%:\Documents and Settings" Quote
M0XIE Posted May 29, 2009 Posted May 29, 2009 was reading thread hit wrong button, sorry for the bump Quote
Retro-Starr Posted May 29, 2009 Posted May 29, 2009 You bumped it, I'll now answer it. To make this script completely useful use: set "drive=%~d0" This is saying that your using the drive that the script is running from, so you could even use this on your local computer because it'll just pick the C partition (or the one your using). Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.