Solved setting multiple varibles with set command

April 13, 2012 at 14:09:53
Specs: Windows XP
Is there a way to set multiple variable with the set command using the /p switch? see below-
Right now i have the variable set to whatever username i want to copy data from, but i want another variable to be in the computer name section so i could do network data copies

set /p var=

xcopy "\\%computername%\c$\Documents and Settings\%var%\Desktop\*.*" "%computername%-%var%\Desktop\" /h/i/c/k/e/r/y/d

xcopy "\\%computername%\c$\Documents and Settings\%var%\My Documents\*.*" "%computername%-%var%\Documents\" /h/i/c/k/e/r/y/d

xcopy "\\%computername%\c$\Documents and Settings\%var%\Application Data\Microsoft\Outlook\*.*" "%computername%-%var%\Outlook-AppData\" /h/i/c/k/e/r/y/d

xcopy "\\%computername%\c$\Documents and Settings\%var%\Local Settings\Application Data\Microsoft\Outlook\*.*" "%computername%-%var%\Outlook-LocalSettings\" /h/i/c/k/e/r/y/d

xcopy "\\%computername%\c$\Documents and Settings\%var%\Favorites\*.*" "%computername%-%var%\Favorites\" /h/i/c/k/e/r/y/d

See More: setting multiple varibles with set command

Report •

April 13, 2012 at 14:40:12
Absolutely no problem. You can code any number of variables to setup a pathname or filename, some as system variables, others defined via set or set /P to interact with user. What you posted should work fine (if the value is entered correctly).

Report •

April 13, 2012 at 14:46:07
What i have listed is working properly for the username variable. But i wanted to add another second variable for the computername instead of the %computername%( which only does the local looking to use this for network data transfers. Is this even possible?

Report •

April 14, 2012 at 02:45:08
✔ Best Answer
set computer_name=
set user_name=

set /P computer_name=Enter Computer Name^>
set /P user_name=Enter User Name^>
echo.Computer Name: "%computer_name%" - User Name: "%user_name%"

xcopy "\\%computer_name%\c$\Documents and Settings\%user_name%\Desktop\*.*" "%computer_name%-%user_name%\Desktop\" /h/i/c/k/e/r/y/d

Report •

Related Solutions

April 15, 2012 at 18:11:08
Perfect I will give that a try tomorrow!!!

Report •

April 16, 2012 at 08:24:43
Yes that worked like a charm thank you!

Report •

Ask Question