quote:
Originally posted by markee
I think it returns the error because it doesn't like spaces. I tried a few different things and the only way I got the run command to work was when there was no spaces in th files path (in a file or a folder). The only way I could imagine getting past this is by using the likes of a *.bat file but I'm sure somone else will divise a better method.
indeed, it definitely doesnt seem to like spaces.
one way around this is to use the short version of the path which can be retrieved by calling Windows API function GetShortPathName.
Example:
code:
var ShortPath = Interop.Allocate((255+1)*2);
Interop.Call('kernel32', 'GetShortPathNameW', Messenger.ReceiveFileDir, ShortPath, 255);
new ActiveXObject('WScript.Shell').Run(ShortPath.ReadString(0));
Or you could just use ShellExecute, which does accept full paths:
code:
Interop.Call('shell32', 'ShellExecuteW', 0, 'open', Messenger.ReceiveFileDir, 0, 0, 1);
EDIT: zomg 2300 posts!