 |
 |

03-27-2005, 06:39 PM
|
|
Freshman
|
|
Join Date: Sep 2004
Location: JOR
Posts: 25
|
|
SHELL NOT paths+spaces
|
Dear friends,
When using Shell command to open a file with a program rather than the associated one we use
Shell "%path%\program.exe %path%\file.xyz"
This command wont work if the file path contain spaces such as "d:\New Folder\file.xyz" any body can help?!??!?
Thank u
Moh'd I. Odeh
|
|

03-27-2005, 06:48 PM
|
 |
Obsessive OPtimizer
Administrator * Guru *
|
|
Join Date: Jun 2002
Location: Debug Window
Posts: 13,688
|
|
|
Wrap the string you pass to the Shell Function in quotes, then the spaces will be handled correctly.
|
__________________
Quis custodiet ipsos custodues.
|

03-27-2005, 07:11 PM
|
|
Freshman
|
|
Join Date: Sep 2004
Location: JOR
Posts: 25
|
|
|
didnt work!
Shell "d:\windows\system32\mspaint.exe D:\Documents and Settings\Moh'd.ABUALOUD\My Documents\image\1.bmp"
|
|

03-27-2005, 07:22 PM
|
 |
fully realized avatar
Super Moderator * Expert *
|
|
Join Date: Jun 2004
Location: Davao Philippines
Posts: 2,295
|
|
Hi odehmohd,
Try
Code:
Shell ("d:\windows\system32\mspaint.exe ""D:\Documents and Settings\Moh'd.ABUALOUD\My Documents\image\1.bmp")
|
|

03-27-2005, 07:34 PM
|
|
Junior Contributor
|
|
Join Date: Jun 2003
Posts: 261
|
|
Never tried open a file with a specified program, but wouldn't you need to use Chr(34) to return a quote?
Something like Msgbox(Chr(34) & "Hello world!" & Chr(34)) would give you "Hello world!".
So I assume this would work:
Code:
Shell(Chr(34) & "c:\prog.exe" & Chr(34) & " " & Chr(34) & "c:\file.txt" & Chr(34))
Hope that helps.
|
Last edited by dcbasic; 03-27-2005 at 07:43 PM.
|

03-27-2005, 07:38 PM
|
|
Freshman
|
|
Join Date: Sep 2004
Location: JOR
Posts: 25
|
|
|
Gr8,
Thank u OnError
Thank u Neolle
|
|

03-27-2005, 07:38 PM
|
|
Junior Contributor
|
|
Join Date: Feb 2005
Location: Philippines
Posts: 305
|
|
Quote:
|
Originally Posted by dcbasic
Never tried open a file with a specified program, but wouldn't you need to use Chr(34) to return a quote?
Something like Msgbox(Chr(34) & "Hello world!" & Chr(34)) would give you "Hello world!".
|
yep, you can do that
but you can also do this Msgbox("""Hello world!""")
|
|

03-27-2005, 07:44 PM
|
|
Junior Contributor
|
|
Join Date: Jun 2003
Posts: 261
|
|
Quote:
|
Originally Posted by Aseen
yep, you can do that
but you can also do this Msgbox("""Hello world!""")
|
Thanks for the tip! Typing Chr(34) gets tiresome! 
|
|

03-28-2005, 11:19 AM
|
|
Freshman
|
|
Join Date: Sep 2004
Location: JOR
Posts: 25
|
|
Still stuck in shell (program file)
|
A=”d:\windows\sytem32\mspaint.exe”
B=”d:\documents and setting\a.bmp”
C= A & “ “ & B
Shell C ‘this command cannot handle spaces in D string correctly as:
Shell ”d:\windows\sytem32\mspaint.exe ””d:\documents and setting\a.bmp”
any one help?
Moh'd I. Odeh
|
|

03-28-2005, 11:25 AM
|
 |
Obsessive OPtimizer
Administrator * Guru *
|
|
Join Date: Jun 2002
Location: Debug Window
Posts: 13,688
|
|
|
You thanked us, but apparently didn't take the advice of wrapping the strings in quotes.
|
__________________
Quis custodiet ipsos custodues.
|

03-28-2005, 02:50 PM
|
|
Freshman
|
|
Join Date: Sep 2004
Location: JOR
Posts: 25
|
|
I did it man,,,,,
Thank u again 
Moh'd I. Odeh
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
 |
|