Problem with Process.StartInfo.Arguments line.

  • Thread starter Thread starter Dave M.
  • Start date Start date
D

Dave M.

Hello,

I'm launching Windows Media Player successfully with the following code:


Dim myProcess As New Process

myProcess.StartInfo.FileName = "wmplayer.exe"

myProcess.StartInfo.Arguments = "\media\TestVideo.wmv /fullscreen"


This only works because I made a folder 'media' and the foldername contains
no spaces. Pointing to a file in a folder that has a space in the folder
name (such as \My Documents\ or \Storage Card\ fails, even though I
successfully check for the existance to the file before launching WMP. I'm
guessing the issue is with the way the myProcess.StartInfo.Arguments line is
parsed.

Does anyone have any ideas?

Thanks in advance for any help.

Dave M.
 
Try adding quotes to your command line so WMP knows where the filename
starts and ends, just as you would form a console.

myProcess.StartInfo.Arguments = "\"\My Folder\TestVideo.wmv\" /fullscreen"
 
Chris,

I appreciate the reply, but I'm still having problems! I initally had tried
nesting the quotes as you had suggested, but VS doesn't seem to like it in
this case. I generates a 'End of statement expected' error.

Dave M.
 
Then try a single quote. Or try starting WMP from teh command prompt and
whatever you enter there is what it expects here. The problem is that WMP
doesn't understand what you're passing into it.
 
You need to add quotes around the path, in VB this should be something
like:-
myProcess.StartInfo.Arguments = """\My Documents\TestVideo.wmv""
/fullscreen"

Peter
 
Thanks Peter! That fixed me up!!

Peter Foot said:
You need to add quotes around the path, in VB this should be something
like:-
myProcess.StartInfo.Arguments = """\My Documents\TestVideo.wmv""
/fullscreen"

Peter
 
Back
Top