Launching Word documents or audio and video from a multimedia CD is a common task that, until the release of Vista, was relatively painless. You just put something like START c:\readme.doc or START c:\video.wmv in a BAT file and that was it. If you've shipped CDs using thiis technique then you're probably getting calls from customers, or you will be soon. Keep reading and you'll have an answer when the calls start.
If you type START c:\video.wmv from a command prompt or the Run dialog box it will work. If you put that same command in a BAT file and try it, Word will start but your document won't be opened.
If you know anything about Windows programming you might think that you could just use the ShellExecute function to launch the application since it's the function that you call to open a file in its default application. The only job of ShellExecute is to interrogate the registry, figure out how to launch the file and then do it for you. It's worked since Windows 95, but no more.
I've seen this on Vista but it doesn't appear to be a problem with Vista because it doesn't affect all applications the same way. I've confirmed this problem with Windows Media Player and Microsoft Word but it works fine with text files (they are opened in Notepad).
So ShellExecute isn't reliable enough and the START command isn't an option unless you want to tell your users what to type from a command prompt. I don't know how ShellExecute is broken or how to get around it, and you can't wait for Microsoft to fix it. You need a solution now and I have one.
If you supply the full path to wmplayer.exe in a BAT file and pass the file you want to open as an argument . For example "C:\Program Files\Windows Media Player\wmplayer.exe" c:\video.wmv opens a c:\video.wmv in Windows Media Player where using START c:\video.wmv from a BAT file fails miserably.
My solution was to build a new tool (ncstart) that you can use inside your BAT files instead of the START command, one that will wok on all Windows desktop operating systems. The ncstart tool will do what the ShellExecute function and the START comamnd were supposed to do... look at the file you're trying to open, figure out which application is needed to open that file and then do it.
usage: ncstart.exe /path filespec /verb verb
The /path switch is where you specify the file that you want to open. You don't need to put quotes around the path, ncstart will take care of all that nonsense for you.
The /verb switch is optional and tells ncstart what you want to do with the file. In most cases you can just leave this out and ncstart will assume you want to use the open verb, which is the default for most files. If you run across a file that isn't opening properly, right click on the file and look for the bold item in the menu, that is the default verb, which is play in the menu below.
example: ncstart.exe /path C:\Documents and Settings\Tim\Desktop\Test.doc
You can use ncstart as a replacement for the START command in your BAT files to launch files but you're still going to see the ugly DOS box that appears when you use a BAT file. If you want to make your presentations look more professional you might want to have a look at my Proxy tool as well.
Released: July 28, 2008
Download: ncstart.exe (96KB)