Iznogoud Posted January 23, 2006 Share Posted January 23, 2006 (edited) Maybe a stupid question but i how can you use simple commands like "copy C:\Documents and Settings\%username% C:\Backup" for an example? Does it needs an extra character or am i missing something? Reason: Because i want to make a script for copying the most common things and keep the script AutoIT only. I can do it by running a batch script from AutoIT script, but this is not a nice solution. The variables from the SET command in DOS prompt is the list wich i would like to use in AutoIT Edited January 23, 2006 by Iznogoud Link to comment Share on other sites More sharing options...
Nuffilein805 Posted January 23, 2006 Share Posted January 23, 2006 filecopy(@userprofiledir & "\*.*", "c:\backup\*.*") this should do the job @userprofiledir = path to current users profile e.g. c:\documents and settings\guest hope this could help you my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
GaryFrost Posted January 23, 2006 Share Posted January 23, 2006 Look at dircopy function in the help and also the macro @UserProfileDir example: DirCopy(@UserProfileDir, "C:\Backup") SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Nuffilein805 Posted January 23, 2006 Share Posted January 23, 2006 (edited) you could do Run(@ComSpec & " /c " & 'copy C:\Documents and Settings\%username% C:\Backup', "", @SW_HIDE) as well you can do every doscommand in the ' ' Edited January 23, 2006 by Nuffilein805 my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
GaryFrost Posted January 23, 2006 Share Posted January 23, 2006 where there is a will, there are multiple ways SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Nuffilein805 Posted January 23, 2006 Share Posted January 23, 2006 there are quite a lot of ways - you just have to ask the help-file my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
Iznogoud Posted January 23, 2006 Author Share Posted January 23, 2006 (edited) you could do Run(@ComSpec & " /c " & 'copy C:\Documents and Settings\%username% C:\Backup', "", @SW_HIDE) as well you can do every doscommand in the ' ' I hoped this one would get passed here This is just the one i tried in different ways, but with the ComSpec line you can't use %username% or %temp% etc. I will try the other right away And yes i have looked at the help file, but you need to know where to look for. Now i do "Macro Reference" Edited January 23, 2006 by Iznogoud Link to comment Share on other sites More sharing options...
trids Posted January 24, 2006 Share Posted January 24, 2006 Using DOS commands with @COMSPEC can provide some very handy shortcuts (especially when it comes to recursion, but that's another topic ) .. TIP: first get the syntax right by trying it out at the command prompt. When I tried out what you're doing, at my own command prompt, I got an error message saying "The system cannot find the file specified" - whether I was using a copy or dir command. However, using cd on the same path specification worked fine...dir C:\Documents and Settings\%username% <-- fails dir C:\Documents and Settings\Trids <-- fails cd C:\Documents and Settings\%username% <-- works cd C:\Documents and Settings\Trids <-- works.. which suggests where the "problem" lies: that dir and copy evidently won't let you hack into the C:\Documents and Settings\ folders, while cd behaves as expected (subject to your Windows access rights).Bottom line .. don't be discouraged from using DOS commands with AU3, just be sure to confirm expected results at the DOS prompt while you're coding, so that you can make informed decisions.HTH 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