Launching an exe with chr(34) arguments

Hi all
I’m having a problem calling a program I have that requires a command argument wrapped in “”.

Ie,

start test_v101.exe “C:\file1.mp4”

notice how the mp4 file requires the double quotes.

I’ve tried this
dim s as new shell

s.Execute(“start " + chr(34) +chr(34) +” " + chr(34) + chr(34) + “C:\UserFolder\Executables\test_v101.exe” +chr(34) +chr(34) )

Without success. I’ve tried variations of the chr(34) with no luck. The test exe launches, but the argument is not passed correctly.

Any thoughts on how to launch this application with the right arguments?

Thanks heaps!
James

s="start test_v101.exe "+chrb(34)+"C:\\file1.mp4"+chrb(34)

should be as simple as that… not sure why you had 6 chr(34)… only 2 are required

Dave’s right, the parameter to Execute differs from your example significantly. It comes out to:

start "" ""C:\\UserFolder\\Executables\\text_v101.exe""

Also, you can embed quotes in a string by doubling them up.

s.Execute _
    "start ""C:\\UserFolder\\Executables\\test_v101.exe"""

That will be sent as:

start "C:\\UserFolder\\Executables\\test_v101.exe"

Thanks guys,

I’ll check both options out in the morning. I think my double quotes are a hold over from an earlier project but I can’t remember what they were for :wink:

Thanks, I’ll report back!

J

So the reason for all the " characters is that I’m escaping spaces in the path name. ie, start “” “c:\test work\360.exe” is required to wrap a path name with spaces in it. I’m still having problems launching the argument even when I get an output in a text box like this:

start “” “C:\test work\360.exe” “C:\test.mp4” which is what it looks like in a dos window:)

I’m using this code:

s.execute("start " +chr(34) + chr(34) + " " + """C:test work\\360.exe""" + " " + """c:\\test.mp4""")

Any suggestions?

Looks identical in a message box and works in a dos prompt…

Got me stumped!

Should add that it launches 360.exe but doesn’t pass the mp4 argument.

Cheers,
James

s.execute("start " +chr(34)  +"C:test work\\360.exe"+chr(34) + " " + +chr(34)+"c:\\test.mp4"+chr(34)

don’t know why you insist on over-complicating it…

Hi David,

Thanks for your help. Certainly not trying to overcomplicate, just trying to recreate the dos command.

I managed to get it working by modifying the above and putting in the escape characters:

s.execute("start " +chr(34)+chr(34) + " " +chr(34)  +"C:test work\\360.exe"+chr(34) + " " + +chr(34)+"c:\\test.mp4"+chr(34)

Works a treat now. Although I’m not sure what the difference between “”" and chr(34) + " is…

Thanks again all!