| View previous topic :: View next topic |
| Author |
Message |
jroad
Joined: 06 Feb 2006 Posts: 26
|
Posted: Tue Feb 21, 2006 1:00 am Post subject: Run, %comspec% where target & params have spaces |
|
|
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 |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Tue Feb 21, 2006 2:21 am Post subject: |
|
|
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 |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Tue Feb 21, 2006 9:12 am Post subject: |
|
|
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 |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2436
|
Posted: Tue Feb 21, 2006 7:41 pm Post subject: |
|
|
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 ... |
|
| Back to top |
|
 |
|