Jaym 0 Posted February 22 Share Posted February 22 Hi, I am new to automate scripting and i am trying to excite the following command copy "c:\windows\temp\documents\custom office templates\*.*" "%userprofile%\appdata\Roaming\Microsoft\Templates\Custom.dotx" But its failing on %userprofile%, i just want the script to copy the file from temp to the current users path Is there a different command i should be using? Quote Link to post Share on other sites
gstone 0 Posted February 22 Share Posted February 22 Yep, you have a couple issues here. First you shouldn't use the 'Shell as Admin' there's a few posts on here which will discuss why you don't use this step Second you are using a Windows system variable which doesn't work with Automate command because it's not running as the user itself You have 1 of 2 ways to accomplish this. Simple way though not exactly all that reliable, you can set the 'If' to 'Console Logged On'. Obviously this will only run if the user is logged in, you would then use the 'Console Shell' function. If the user doesn't have access to the temp folder then it wouldn't work The other way would be to precede this with a Script Step with Function: Variable Set Set Type: Sql Query parameter: SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(LastUsername,'\\',-1) ,',',1) FROM Computers WHERE computerID = "%computerID" Variable Name: LastUser change the Script Step you have here to Function: shell Source Patch: copy "c:\win..." "c:\@LastUser@\... The @@ uses the variable created with the Variable Set function This is just a simple option, obviously if there home folder is different from their user name it wouldn't work. I'm sure someone else has a more eloquent method than I do but figure at least give you a start Quote Link to post Share on other sites
Jaym 0 Posted February 24 Author Share Posted February 24 Thanks Gstone, I will give the 2nd option a try. Quote Link to post Share on other sites
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.