Hi and welcome to the board.

A few things that pop up at first sight:

  • Please use code tags when posting code.
  • You need to match your quotes. Double or single quotes does not really matter as long as they are used in pairs.
  • Never include variables or macro’s in a string. They may not be resolved correctly.
  • The dollar character is a reserved character in kix so using it in a path might cause issues. NoVarsInStrings should take care of this.
  • Commenting lines can be done with the ; character and not the minus character.
  • Regular users will not have access to the admin share on any computer, \\server01\e$ in your script.
  • Personally I not care so much for the /c parameter in the copy command. It continues even if there are errors. I would like it to stop if there are errors and put in some error logging code so it is clear what is going wrong.


The code below is a bit cleaned up and at first sight looks like it should do the job but I did not test it.
 Code:
$rc = SetOption("NoVarsInStrings", "On")

$Desktop_Loc = ExpandEnvironmentVars(%USERPROFILE%)
$Desktop_Loc = $Desktop_Loc + "\Desktop"

If Exist ("\\serv01\home\" + @USERID + "\windows\migration.txt") ;homedrive of the user
	If Exist ("\\serv01\e$\anwprofl\tsp_" + @USERID) ; profile-path of the user
		Copy "\\serv01\e$\anwprofl\tsp_" + @USERID + "\*.*" $Desktop_Loc + "\" /c /s
	EndIf
EndIf


Edited by Mart (2012-10-08 12:21 PM)
Edit Reason: Corrected the code
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.