MrBoo Posted January 21, 2008 Posted January 21, 2008 Hey folks, This is probably a really simple one, but I'm struggling and I'd be really grateful if someone could help me out... I'm making a script that will run on multiple systems. As part of the script, it will copy a file from one location (say: C:\settings-temp\options.xml) to a subfolder of the active user's documents folder (for example: C:\Users\-USERNAME-\Documents\Options\options.xml). The issue is that each system the script needs to run on will have a different active username when the script runs. I figured $var would probably be useful here... If I run (as the example in the script reference): $var = EnvGet("USERPROFILE") MsgBox(4096, "Path variable is:", $var) ...A Message-box pops-up with the correct path (in this case - C:\Users\Rob) So, next I tried to use the following: $var = EnvGet("USERPROFILE") FileCopy("C:\settings-temp\options.xml","$var\Documents\Options\options.xml", 9) ...Unfortunately it doesn't copy the file, and as far as I can see there's no error code. Does anyone have an idea of how I can do what I'm trying-to? Any advice would be fantastic!... Thanks and regards, Rob.
MrBoo Posted January 21, 2008 Author Posted January 21, 2008 Just a quick update... It's sort-of copying the file... Just not to where I need it... When the script runs it's making a folder on my Desktop - $var\Options\ and putting the file options.xml in there? Thanks and regards, Rob. PS> At the moment the system I'm using is Windows Vista, ideally I need to get this working on XP too.
picaxe Posted January 21, 2008 Posted January 21, 2008 Try $var = EnvGet("USERPROFILE") FileCopy("C:\settings-temp\options.xml",$var & "\Documents\Options\options.xml", 9)oÝ÷ ÚÛzÛ^«¢+Ù¥± ½Áä ÅÕ½ÐíèÀäÈíÍÑÑ¥¹ÌµÑµÀÀäÈí½ÁÑ¥½¹Ì¹áµ°ÅÕ½Ðì±UÍÉAɽ¥±¥ÈµÀìÅÕ½ÐìÀäÈí½Õµ¹ÑÌÀäÈí=ÁÑ¥½¹ÌÀäÈí½ÁÑ¥½¹Ì¹áµ°ÅÕ½Ðì°ä¤
Developers Jos Posted January 21, 2008 Developers Posted January 21, 2008 The var concatenation is specified wrong: FileCopy("C:\settings-temp\options.xml",$var & '\Documents\Options\options.xml", 9) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
MrBoo Posted January 21, 2008 Author Posted January 21, 2008 Guys, that's awesome! Thanks very much indeed for your help. It's working exactly as hoped now! Thanks again! Rob.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now