|Okay, I didn't see any difference at a glance in the code however that works. There is a different error that I am not sure if we can do anything about|
Type in Wayne<> for the name:
Errors: > was unexpected at this time.
Your newest code repaired the above error. I will test.
The other questions I wanted to get your help on if you don't mind. These are acutally in separate posts:
1. Listing and using all of the non-active profiles in a local computer. These are the profiles that are not the system ones and not the one that the batch file is being run from.
I know that I can get the current user:
for /f "tokens=3 delims=\" %%i in ("%USERPROFILE%") do (set puser=%%i) 2>&1
I know that I can list and exclude the ones that I know about with this:
for /f "tokens=*" %%a in ('dir c:\docume~1 /b /ad') do call :process "%%a"
if [%1]==["Administrator"] goto :eof
if [%1]==["All Users"] goto :eof
if [%1]==["Default User"] goto :eof
if [%1]==["LocalService"] goto :eof
if [%1]==["NetworkService"] goto :eof
How do I capture and use the rest of what is there? Let's say there are 5 profiles, Tina, Tony, Owner, Wayne, Thomas. We are running the batch file from Owner. I want to be able to capture Tina, Tony, Wayne and Thomas into separate variables let's say user2, user3, user4, user5, etc etc etc. The number of variables necessary would depend on how many user accounts there are.
2. I am running into an insufficient memory error. This is being caused by too many characters in the destination of XCOPY (greater than 254). I cannot use XXCOPY or Robocopy to work around this as everyone is suggesting. I would like the get the length of the path that XCOPY is copying from and based upon that number returned if it is greater than 230, I would like to either auto truncate the files or stop xcopy, automatically rename the destination folder (%folder%) on the destination drive (%drive%) and then continue XCOPY.
I know I can get length utilizing a modification of this code:
:: Send the length of the variable %MyVar%
:: to the variable %length%
if defined # (set #=%#:~1%&set /A length += 1&goto loop)
echo MyVar is %length% characters long!
Wonder if you have any thoughts.