By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,640 Members | 1,108 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,640 IT Pros & Developers. It's quick & easy.

Shellexecute path problem even with double quote

P: 4
Hi,

I am trying to use ShellExecute function to invoke the ax program.

The code below works perfect:
ShellExecute(0&, "open", "ax.exe", "C:\2runtemp2.run", "C:\axfolder", 5)

The code below does NOT work:
ShellExecute(0&, "open", "ax.exe", "C:\Documents and Settings\jon\Desktop\requiredfiles\2runtemp2.run", "C:\axfolder", 5)


Because of some design issues, the arguement "must" have spaces in its full path. Even though I write the path in double quotations, I can not prevent this error.


Any help on the error is much appreciated. Thanks,
jon
May 22 '07 #1
Share this Question
Share on Google+
3 Replies

Rabbit
Expert Mod 10K+
P: 12,441
Hi,

I am trying to use ShellExecute function to invoke the ax program.

The code below works perfect:
ShellExecute(0&, "open", "ax.exe", "C:\2runtemp2.run", "C:\axfolder", 5)

The code below does NOT work:
ShellExecute(0&, "open", "ax.exe", "C:\Documents and Settings\jon\Desktop\requiredfiles\2runtemp2.run", "C:\axfolder", 5)


Because of some design issues, the arguement "must" have spaces in its full path. Even though I write the path in double quotations, I can not prevent this error.


Any help on the error is much appreciated. Thanks,
jon
ShellExecute(0&, "open", "ax.exe", """C:\Documents and Settings\jon\Desktop\requiredfiles\2runtemp2.run"" ", "C:\axfolder", 5)
May 22 '07 #2

JConsulting
Expert 100+
P: 603
ShellExecute(0&, "open", "ax.exe", """C:\Documents and Settings\jon\Desktop\requiredfiles\2runtemp2.run"" ", "C:\axfolder", 5)

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim strPath
  3. Dim retval
  4. strPath = "C:\Documents and Settings\jon\Desktop\requiredfiles\2runtemp2.run"
  5. retval = ShellExecute(0&, "open", "ax.exe", Chr(34) & strPath & Chr(34), "C:\axfolder", 5)
  6.  
may not need the chr(34)...not sure
May 23 '07 #3

jamjar
P: 50
The code below does NOT work:
ShellExecute(0&, "open", "ax.exe", "C:\Documents and Settings\jon\Desktop\requiredfiles\2runtemp2.run", "C:\axfolder", 5)
Not sure if this would work .... try using the "short" folder name, ie, "C:\Docume~1\" instead of "C:\Documents and Settings\" .... ???

James
May 23 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.