Solved I want to run an application and pass it the file to open

June 11, 2012 at 15:48:45
Specs: Windows XP
I am trying to open an application (non microsoft) using vbs and at the same time pass the application I want it to open. See my example below to try open a specific file in vlc media player saved at the location defined in variable arg. I am an absolute newbie as any assitance would be highly appreciated!! Thanks!

For Each a In WScript.Arguments

arg = "D:\test.wmv"
Next 'a
CreateObject("Wscript.Shell" ).Run "F:\vlc.exe" & arg, 1


See More: I want to run an application and pass it the file to open

Report •


#1
June 11, 2012 at 16:10:49
✔ Best Answer
For Each a In WScript.Arguments

arg = "D:\test.wmv"
Next 'a

I'm not sure what you're attempting here, but it can be simplified to:

arg = "D:\test.wmv"

CreateObject("Wscript.Shell" ).Run "F:\vlc.exe" & arg, 1
Change to: (Notice: a space was added)

CreateObject("Wscript.Shell" ).Run "F:\vlc.exe " & arg, 1

How To Ask Questions The Smart Way


Report •

#2
June 13, 2012 at 04:42:53
Worked like a charm. Thanks

Report •

Related Solutions


Ask Question