Groups | Blog | Home
all groups > dotnet compact framework > january 2007 >

dotnet compact framework : Problem with Process.StartInfo.Arguments line.


Dave M.
1/11/2007 2:42:34 PM
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.





ctacke/
1/11/2007 2:50:34 PM
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 Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--


[quoted text, click to view]

dave m
1/11/2007 3:14:37 PM
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.


[quoted text, click to view]

ctacke/
1/11/2007 4:13:11 PM
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.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--



[quoted text, click to view]

Peter Foot [MVP]
1/12/2007 10:30:01 AM
You need to add quotes around the path, in VB this should be something
like:-
myProcess.StartInfo.Arguments = """\My Documents\TestVideo.wmv""
/fullscreen"

Peter

--
Peter Foot
Device Application Development MVP
www.peterfoot.net | www.inthehand.com

[quoted text, click to view]
dave m
1/18/2007 10:07:39 AM
Thanks Peter! That fixed me up!!

[quoted text, click to view]

AddThis Social Bookmark Button