bobheart Posted June 8, 2004 Share Posted June 8, 2004 DirCreate("C:\Mydosbackups") Run(@ComSpec & " /C:\WINDOWS\*.ini, ""C:\Mydosbackups,"") Run(@ComSpec & " /C:\WINDOWS\*.bat, ""C:\Mydosbackups,"") --------------------------- AutoIt Error --------------------------- Line 3 (File "E:\Programs\AutoIt3\Examples\june7\copy.au3"): Run(@ComSpec & "" /C:\WINDOWS\*.ini, ""C:\Mydosbackups,"") Run(@ComSpec & "" /C^ ERROR Error: Unable to parse line. Link to comment Share on other sites More sharing options...
pekster Posted June 8, 2004 Share Posted June 8, 2004 (edited) To illustrate what is wrong, I will color your code. Strings in blue, with the enclosed quotation marks in green and incraesed in size.DirCreate("C:\Mydosbackups")Run(@ComSpec & " /C:\WINDOWS\*.ini, ""C:\Mydosbackups,"")Run(@ComSpec & " /C:\WINDOWS\*.bat, ""C:\Mydosbackups,"")As should be clear now, you have two strings just sitting next to each other on several occations. Try reformatting your strings so that it ends up being a valid command. Make sure commas end up outside strings if you want to use a 2nd paramater for functions, and that strings you wish to join are properly joined with the & symbol.Bah, it's late, and I can't think. Several words replaced, and the syntax highlighting fixed in this edit. Edited June 8, 2004 by pekster [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes. Link to comment Share on other sites More sharing options...
bobheart Posted June 8, 2004 Author Share Posted June 8, 2004 (edited) Ok No errors now but it won't copy the ini files ?and the dos box won't hide . DirCreate("C:\Mydosbackups2") Run(@ComSpec & " /C:\WINDOWS\*.ini C:\Mydosbackups2 ,@SW_HIDE") Edited June 8, 2004 by bobheart Link to comment Share on other sites More sharing options...
pekster Posted June 8, 2004 Share Posted June 8, 2004 (edited) Syntax for the Run function with the Comm Interperter is as follows (taken from the helpfile with highlighting): Run( @ComSpec & "/c " & "CommandName", "Workingdir", <FLAG>)You appear to have used the /C, but didn't use a space after it. In addition, the following is not a valid DOS command: " /C:\WINDOWS\*.ini C:\Mydosbackups2 ,@SW_HIDE", which is what you told it to run.Perhaps you mean:Run( @ComSpec & "/c " & "copy C:\WINDOWS\*.ini C:\Mydosbackups2", "", @SW_HIDE)Note: that code is the same as the one below. However, you must make sure there is a space after the /c part of the string, and the rest of your DOS command, otherwise you'll have this problem.Run( @ComSpec & "/c copy C:\WINDOWS\*.ini C:\Mydosbackups2", "", @SW_HIDE)Edited to add in my close parentheses and fix a spelling errorEdited again to add in the code at the bottom I referanced but forgot to include Edited June 8, 2004 by pekster [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes. Link to comment Share on other sites More sharing options...
bobheart Posted June 8, 2004 Author Share Posted June 8, 2004 (edited) I'm not sure I'm looking at the same help file as all I found was this . value of %comspec%, the SPECified secondary COMmand interpreter; primarly for command line uses, e.g. Run(@ComSpec & " /k help | more") So thats what I was going by to do it . Thank you for the help . Just ran what you had and got this ? --------------------------- AutoIt Error --------------------------- Line 2 (File "E:\Programs\AutoIt3\Examples\june7\copy.au3"): Run( @ComSpec & "/c copy C:\WINDOWS\*.ini C:\Mydosbackups2", "", @SW_HIDE) Error: Unable to execute the external program. The system cannot find the path specified. --------------------------- OK --------------------------- Edited June 8, 2004 by bobheart Link to comment Share on other sites More sharing options...
pekster Posted June 8, 2004 Share Posted June 8, 2004 I'm not sure I'm looking at the same help file as all I found was this .Look at the Run function, found in the AutoIt: Function Referance: Process Management: Run section. See also: RunWait in the same path. [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes. Link to comment Share on other sites More sharing options...
pekster Posted June 8, 2004 Share Posted June 8, 2004 Just ran what you had and got this ?Whopsie. You need a space before the /c part of the string, otherwise it runs into the location of the Command Interperter. so the first string should read quotation mark + space + slash + 'c' + quotation mark. [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes. Link to comment Share on other sites More sharing options...
bobheart Posted June 8, 2004 Author Share Posted June 8, 2004 That was it , runs fine now . thank you . Can I add like dos and do *.ini *.bat *.dat etc ? so it can be all on one line . Link to comment Share on other sites More sharing options...
bobheart Posted June 8, 2004 Author Share Posted June 8, 2004 Well that didn't work . the way I got it to work was doing like this . DirCreate("C:\Mydosbackups2") Run( @ComSpec & " /c copy C:\WINDOWS\*.ini C:\Mydosbackups2", "", @SW_HIDE) Run( @ComSpec & " /c copy C:\WINDOWS\*.dat C:\Mydosbackups2", "", @SW_HIDE) Run( @ComSpec & " /c copy C:\WINDOWS\*.bat C:\Mydosbackups2", "", @SW_HIDE) Run( @ComSpec & " /c copy C:\*.ini C:\Mydosbackups2", "", @SW_HIDE) Run( @ComSpec & " /c copy C:\*.bat C:\Mydosbackups2", "", @SW_HIDE) Run( @ComSpec & " /c copy C:\*.dat C:\Mydosbackups2", "", @SW_HIDE) Is there a better way ? Link to comment Share on other sites More sharing options...
tutor2000 Posted June 8, 2004 Share Posted June 8, 2004 Can't you use filecopy? Rick Only $2.00 with Resale Rights How to Block Better for Martial Artists and NonMartial Artistshttp://kirkhamsebooks.com/MartialArts/Bloc...tterEbook_m.htm 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