in reply to Program Not Found when run from browser page

If you can execute the program from command line in Windows 10, then I am pretty sure that you are either in the directory where this program is located or the program is in the path. So, just type the word "PATH" and press enter. See what it says. The program should be in one of those paths listed. They are separated by a semicolon. Or if it's not, then type "CD" and press Enter. It will give you the current directory and just see if it's there. Type "DIR *.EXE /P" to see what program files you have in the current directory. So, once you locate the program, then you have to execute it using full path. For example, system("C:\\MyProgram\\myprog.exe"); Don't forget to put double \\ because \ is an escape character, it must be doubled for it to produce a single \

For example, the following perl program line will launch Microsoft Word on my PC:

system("C:\\Program Files\\Microsoft Office\\OFFICE11\\WINWORD.EXE");


When I try the same in JSScript, an interesting thing happens... Hmmm..


// This doesn't work for some reason:
// new ActiveXObject("WScript.Shell").Run("C:\\Program Files\\Microsoft Office\\OFFICE11\\WINWORD.EXE");

// This one works.
new ActiveXObject("WScript.Shell").Run("C:\\PROGRA~1\\MICROS~2\\OFFICE11\\WINWORD.EXE");

Well, this is quite lame. It appears that if your folder or program name has spaces in it or is longer than 8+3 characters that is standard in DOS, then the program must be referred to by its 8+3 name. This is beyond stupid, but this could be the reason why you can't launch the program from JS.

  • Comment on Re: Program Not Found when run from browser page

Replies are listed 'Best First'.
Re^2: Program Not Found when run from browser page
by SankoR (Prior) on Nov 13, 2024 at 21:31 UTC
    Don't forget to put double \\ because \ is an escape character, it must be doubled for it to produce a single \
    Ignoring all the rest of that but you could avoid interpolation by using single quotes.
      Escapes are not a matter of interpolation.

      Even inside single quotes you'll need to double backslashes, otherwise it wouldn't be possible to escape a single quote.

      Consider 'O\'Reilly'

      Probably you are confusing it with the worse "slasheritis" in other languages.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      see Wikisyntax for the Monastery

        In fact, no. If the path doesn't contain single quotes, you don't need to double the backslashes:

        $ perl -wE 'say q(C:\Windows\System)' C:\Windows\System

        I agree it's not exactly interpolation, but still.

        map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]