GeekyITGuy Posted March 18, 2010 Share Posted March 18, 2010 Hi, I am trying to use FileCopy to copy a file from the network to PCs in the following location C:\Users\<currently logged in user>\IPViewer. If I actually put the username in the command eg. FileCopy ("\\Server\Share\File", "C:\Users\Bob\IPViewer", 1) this works, what I want to do is get the username of the person logged in and use that. I have tried the following already "C:\Users\@Username\IPViewer" - no good "C:\Users\%username%\IPViewer" - no good I tried creating a variable to do the same ie; $Login = @UserName or $Login = %username% - then use the variable in the target location C:\Users\$Login\IPViewer - but still no good. Can anyone help please? Many Thanks in advance! Link to comment Share on other sites More sharing options...
99ojo Posted March 18, 2010 Share Posted March 18, 2010 (edited) Hi, try: FileCopy ("\\Server\Share\File", "C:\Users\" & @UserName & "\IPViewer", 1) or $user = EnvGet ("username") FileCopy ("\\Server\Share\File", "C:\Users\" & $user & "\IPViewer", 1) ;-)) Stefan Edited March 18, 2010 by 99ojo Link to comment Share on other sites More sharing options...
GeekyITGuy Posted March 18, 2010 Author Share Posted March 18, 2010 Wow that was quick! Thank-you very much for your help, it worked! I have been trying to do this from yesterday evening I have only just started using AutoIt but so far I am loving it! Thanks again 99ojo. Link to comment Share on other sites More sharing options...
99ojo Posted March 18, 2010 Share Posted March 18, 2010 Hi, you're welcome. Just for future: Read the helpfile, read the helpfile and once again read the helpfile. ;-)))))) Have a look at the macro functions, starting with @. Have a look at functions and user defined functions. Use search in helpfile and on forum. If you have further problems, come back and post. ;-)) Stefan Link to comment Share on other sites More sharing options...
GeekyITGuy Posted March 18, 2010 Author Share Posted March 18, 2010 Thanks for the advice, I did spend quite a while on the forums and the help file but couldnt see where it shows you about enclosing the macro in & &. Would you be kind enough to tell me where I can find further information on this? I dont have a programming background and would like to learn as I go, so forgive me if this seems a bit of a basic question! Cheers! Link to comment Share on other sites More sharing options...
99ojo Posted March 18, 2010 Share Posted March 18, 2010 Hi, sorry if my answer sounds a little bit hard. Have a look into helpfile: - Introduction - FAQ - Tutorials - Language Reference - Gui Reference and most of the question will become clear. As i mentioned, if you have further problems or questions, come back...... ;-)) Stefan Link to comment Share on other sites More sharing options...
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