[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 263
  • Last Modified:

ShellExecute problem!

I have the following lines of code that just won't work for me.  It's like it's executing the correct file but the parameters are not being passed to it.  Any help is greatly appreciated!

objShell.ShellExecute("\\\\tst-app06\\McKesson\\PWHC\\Apps\\pwhc.exe", "\/si\:\\\\tst-app06\\McKesson\\PWHC\\CONFIG\\Prod01", "", "open", 1);

AND (in a different file)

objShell.ShellExecute("\\\\tst\\apps\\SCMS\\SCMSApp.mdb", "/wrkgrp \\\\tst\\apps\\SCMS\\SCMS SYSTEM Security 2003.mdw", "", "open", 1);

0
RobinsRL
Asked:
RobinsRL
  • 5
  • 3
1 Solution
 
ZvonkoSystems architectCommented:
Pass the last parameter as String: "1"

0
 
ZvonkoSystems architectCommented:
Here a tested example:

<HTML>
<HEAD>

<SCRIPT type="text/javascript" LANGUAGE="JavaScript">
  function executeCommands(inputparms)
   {
    var oShell = new ActiveXObject("Shell.Application");
    var commandtoRun = "C:\\Windows\\Notepad.exe";
    if (inputparms != "")
     {
      var commandParms = document.Form1.filename.value;
     }

     oShell.ShellExecute(commandtoRun, commandParms, "", "open", "1");
  }
</SCRIPT>

</HEAD>
<BODY>
<FORM name="Form1">
<CENTER>
<BR><BR>
<H1>Execute PC Commands From HTML </H1>
<BR><BR>
<File Name to Open:> <Input type="text" size="80"
   name="filename" value="c:\windows\FaxSetup.log"/>
<BR><BR>

<input type="Button" name="Button1"
   value="Run Notepad.exe" onClick="executeCommands()" />

<BR><BR>
</CENTER>
</BODY>
</FORM>
</HTML>

0
 
RobinsRLAuthor Commented:
Nope, that didn't work either.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
RobinsRLAuthor Commented:
I've seen that working solution, however, it doesn't help me fix my problem.  The first parameter set is as follows (before jscript adaptation):

/si:\\tst-app06\McKesson\PWHC\CONFIG\Prod01

I could have simply formatted incorrectly.  The second one is as follows:

/wrkgrp \\tst\apps\SCMS\SCMS SYSTEM Security 2003.mdw


Thanks...
0
 
ZvonkoSystems architectCommented:
Are you sure that those parameters are formated like that? Put them in String vars and alert() them out before passing to the calls.

Also be sure that those files shares are accessible. Test the paths in File Explorer.
0
 
ZvonkoSystems architectCommented:
Also check this version:

objShell.ShellExecute("\\\\tst\\apps\\SCMS\\SCMSApp.mdb", '/wrkgrp "\\\\tst\\apps\\SCMS\\SCMS SYSTEM Security 2003.mdw" ', "", "open", "1");


0
 
RobinsRLAuthor Commented:
I'm positive the parameters are formatted like that.  I took them directly from the working shortcuts.  And your suggestion still doesn't work. =(
0
 
ZvonkoSystems architectCommented:
Common, what on my suggestion does not work? My suggestion is tested, Your environment is messy.
Copy that exe and needed directories local on disk and check to execute the programs in a bat file.
If that bat file works, and only after that, search your syntax problems in the html page.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now