zamboni128 Posted February 10, 2008 Share Posted February 10, 2008 I'm trying to run a program that will unzip files to a destination directory. Both the program directory and the destination have spaces in the directory names. I can't not get this to work using runwait but it works from a command line. If I run the following command from the command line... It works "cmd /k" "c:\documents and settings\bobh\desktop\esm test\paext.exe" -t "c:\documents and settings\bobh\desktop\esm test\models_update.zip" If I try the following RunWait, it does not work. It tells me c:\documents is not recognized as an internal or external command. chr(34) & @COMSPEC & " /k" & chr(34) & " " & Chr(34) & @ScriptDir & "\paext.exe" & chr(34) & " -t " & Chr(34) & @ScriptDir & "\" & $sModelsZipFileName & chr(34) @ScriptDir = c:\documents and settings\bobh\desktop\esm test $sModelsZipFileName = models_update.zip It seems like it can't handle more than one set of "s. I even tried mixing double and single quotes. Anybody have any ideas? Thanks in Advance Link to comment Share on other sites More sharing options...
Uten Posted February 10, 2008 Share Posted February 10, 2008 This works on my system: Local $cmd = @COMSPEC & " /k dir " & Chr(34) & @DocumentsCommonDir & chr(34) runwait($cmd, @TempDir, @SW_SHOW) AutoIt version 3.2.11.0 Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
zamboni128 Posted February 10, 2008 Author Share Posted February 10, 2008 This works on my system: Local $cmd = @COMSPEC & " /k dir " & Chr(34) & @DocumentsCommonDir & chr(34) runwait($cmd, @TempDir, @SW_SHOW) AutoIt version 3.2.11.0 This will not always be run from the @DocumentsCommonDir. In most cases it will be run from a temp dir and maybe have spaces in the subdir name. What I'm trying to do is call a program using the full path and pass it switches, unzip directory and directory of zip file. All using full path names. This requires 3 sets of double quotes and I can't make it work. Link to comment Share on other sites More sharing options...
Uten Posted February 10, 2008 Share Posted February 10, 2008 If my sample works you should compare it to your code. I can not run your code as files are missing on my system. So to create a common ground I used @DocumentsCommonDir as it normally does have spaces in it. So, what is the biggest difference between the code you provided and the one I provided? Or: Are you really able to run "cmd /k" (literally including the ") from your run dialog? Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Danny35d Posted February 11, 2008 Share Posted February 11, 2008 It tells me c:\documents is not recognized as an internal or external command. chr(34) & @COMSPEC & " /k" & chr(34) & " " & Chr(34) & @ScriptDir & "\paext.exe" & chr(34) & " -t " & Chr(34) & @ScriptDir & "\" & $sModelsZipFileName & chr(34) @ScriptDir = c:\documents and settings\bobh\desktop\esm test $sModelsZipFileName = models_update.zip It seems like it can't handle more than one set of "s. I even tried mixing double and single quotes. Anybody have any ideas? Thanks in AdvanceA lot of time you get that message when you don't add the working directory. RunWait(@ComSpec & ' /k "' & @ScriptDir & '\paext.exe" -t "' & @ScriptDir & '\' & $sModelsZipFileName & '"', @ScriptDir) AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
zamboni128 Posted February 14, 2008 Author Share Posted February 14, 2008 A lot of time you get that message when you don't add the working directory. RunWait(@ComSpec & ' /k "' & @ScriptDir & '\paext.exe" -t "' & @ScriptDir & '\' & $sModelsZipFileName & '"', @ScriptDir) I tried the above command and the results are attached in the document. I still get the problem where it doesn't handle spaces in the command correctly. The second image in the attachment is a msgbox output of the command. It appears to be correct and if executed from a cmd window, works correctly. It only fails when i use it in an autoit script with a runwait command. Do you have any other ideas? Thanksrunwait.doc Link to comment Share on other sites More sharing options...
GaryFrost Posted February 14, 2008 Share Posted February 14, 2008 FileGetShortName 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...
laidback01 Posted February 14, 2008 Share Posted February 14, 2008 I'm a noob and all, but I'd start at the simplest way first.. Can you run it as such: Run('"c:\documents and settings\bobh\desktop\esm test\paext.exe" -t "c:\documents and settings\bobh\desktop\esm test\models_update.zip"') and have it work? If so, then at least you know it can be done.. and move forward from there. Maybe Im missing something in your question, but well.. maybe this helps too. Link to comment Share on other sites More sharing options...
zamboni128 Posted February 14, 2008 Author Share Posted February 14, 2008 FileGetShortNameUsing FileGetShortName works. Sometimes the simplest solution isn't the most obvious.Thanks 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