AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Run, %comspec% where target & params have spaces

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
jroad



Joined: 06 Feb 2006
Posts: 26

PostPosted: Tue Feb 21, 2006 1:00 am    Post subject: Run, %comspec% where target & params have spaces Reply with quote

As posted in the Ask for help forum here:
http://www.autohotkey.com/forum/viewtopic.php?t=8178

There seems to be a problem using code such as:
Code:
run, %comspec% /K %str_longpathwithspaces% "%param1withspaces%" "%param2withspaces%",,Min


Where both the target and parameters have spaces. The workaround was to use a file reading loop with the targetpath and converting it to %A_LoopFileShortPath%
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Tue Feb 21, 2006 2:21 am    Post subject: Reply with quote

I believe this is a limitation of the command interpreter (cmd.exe) and/or the API's CreateProcess() and ShellExecuteEx() functions. However, I'd welcome any evidence that suggests otherwise, and I would try to fix it.

Have you tried the nested quotes idea I mentioned in the other topic? It might prove useless, but I remember solving a similar problem that way.
Back to top
View user's profile Send private message Send e-mail
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Tue Feb 21, 2006 9:12 am    Post subject: Reply with quote

On C:\WINDOWS\system2\cmd.exe of WinXP SP2, if I do:
"E:\tmp\A B C\ShowParams.ahk" "a b" "d f"
it works as expected.
But if I do:
cmd /k "E:\tmp\A B C\ShowParams.ahk" "a b" "d f"
(or cmd /c) it fails as shown in the given thread. So this seems to be indeed a system limitation.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
corrupt



Joined: 29 Dec 2004
Posts: 2436

PostPosted: Tue Feb 21, 2006 7:41 pm    Post subject: Reply with quote

try:
Code:
cmd /c "c:\Progra~1\AutoHotkey\autohotkey.exe e:\tmp\abc~1\showparams.ahk "a b" "d f""

or
Code:
cmd /c "e:\tmp\abc~1\showparams.ahk "a b" "d f""

In other words... remove the spaces from the path(s)

or

Code:
cmd /c ""e:\tmp\a b c\showparams.ahk" "a b" "d f""




edit: ...but it seems these conclusions have been made in the topic linked in the first message of this thread Rolling Eyes ...
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group