Spaces in filenames Cause Error with VB.NET

Microsoft Windows specific usage questions
Forum rules
Please post only Windows specific questions in this forum category. If you don't know where to post, please read the different forums' rules. Thanks.
Cartaphilus
New Cone
New Cone
Posts: 9
Joined: 19 Aug 2010 14:44

Spaces in filenames Cause Error with VB.NET

Postby Cartaphilus » 28 Aug 2011 23:33

I'm running Windows Vista Home Premium 32-bit and using VLC 1.1.11. I'm trying to use VB.Net to list the movies on a networked drive and allow the user to select and play a movie. I'm using the 'process.start' method and passing the path of the vlc executable and the path of the networked drive and movie file as arguments. The problem appears to be that VLC does not like space characters in any part of the executable path or file name when doing this. For example, my network share name is "//tyrconnell/Brennan (f)/movies" and the file name is "3 Sovereigns for Sarah". When my code executes "process.start("c:\program files\vlc\vlc", "//tyrconnell/Brennan (f)/movies/3 sovereigns for sarah")", VLC starts but doesn't play the movie and gives the following debug information:

Debug///tyrconnell/Brennan
Debug/(f)/movies/3
Debug/Sovereigns
Debug/for
Debug/Sarah

Yet if I just navigate to the title using Windows Explorer, right click on it and select 'Play with VLC' Media Player', the movie plays just fine.

Is this a bug in VLC or am I doing something wrong in my code?

TIA...

rvs75
Blank Cone
Blank Cone
Posts: 38
Joined: 01 Jul 2010 11:48

Re: Spaces in filenames Cause Error with VB.NET

Postby rvs75 » 29 Aug 2011 10:50

Try with triple doublequote.

process.start("c:\program files\vlc\vlc", """//tyrconnell/Brennan (f)/movies/3 sovereigns for sarah""")

Cartaphilus
New Cone
New Cone
Posts: 9
Joined: 19 Aug 2010 14:44

Re: Spaces in filenames Cause Error with VB.NET

Postby Cartaphilus » 31 Aug 2011 12:58

Thanks, rsv75, for the triple quote suggestion. It works if you're using a string, as my example implied. However, I haven't been able to figure out how to make it work if I use a string variable, like this:

moviename="3 Sovereigns for Sarah"
process.start("c:\program files\videolan\vlc\vlc", moviename)

Any ideas?

TIA...


Cartaphilus
New Cone
New Cone
Posts: 9
Joined: 19 Aug 2010 14:44

Re: Spaces in filenames Cause Error with VB.NET

Postby Cartaphilus » 31 Aug 2011 15:16

rvs75,

Thanks again. I actually prefer to be pointed to sources of information rather than just having an answer handed to me (my particular learning style...), so you have been a very big help.

Cartaphilus

c22600
New Cone
New Cone
Posts: 1
Joined: 21 Sep 2013 11:28

Re: Spaces in filenames Cause Error with VB.NET

Postby c22600 » 21 Sep 2013 11:44

I know this is an old thread but I spent hours researching and "experimenting" to resolve passing variable to VLC from .net and finally got it to work with help from the above information. In case someone else stumbles across this thread looking for the answer I was seeking here it is, well works for me.

Environment is W7 64B with MySQL on a linux server.

VB.NET 2010
Dim videofiletoplay As String = """" & txtnvcLocation.Text & "\" & txtnvcTitleFileName.Text & ".mkv"

In this particular example the Console.WriteLine output of the string is: "W:\Shared Videos\SD DVD\30 DAYS OF NIGHT\30 Days Of Night.mkv

Note the use of the ", there is a single double quote at the start of the output string and nothing at the end unlike the """ filename """ if a static filename is used.

Full command is : Process.Start("C:\Program Files (x86)\VideoLAN\VLC\vlc.exe", videofiletoplay)

Hope this helps ..........


Return to “VLC media player for Windows Troubleshooting”

Who is online

Users browsing this forum: No registered users and 37 guests