Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
start App using command line parameters
#1
follow these manual steps:
  1. Open the D:\RPA\XX folder.
  2. Launch cmd.exe in the current folder.
  3. Enter the command: pm2 start dist/index.js --name "AA"
  4. Successfully execute the program I need.
However, when I use the following code, it prompts the following error.
--------------------------------------------------------------------
Au.Types.AuException: Failed. %1 is not a valid Win32 application. (193).
1

--------------------------------------------------------------------

Is there any other simple solution?
Note: pm2 is a module of node.js, and it seems there is no pm2.exe file in the above folder.
https://i.ibb.co/F5jHsNZ/pm2.png
 
Code:
Copy      Help
// script "cmd2.cs"
//.
script.setup(trayIcon: true, sleepExit: true, exitKey: KKey.Pause);
//..
print.clear();

string nodePath = @"C:\Program Files\nodejs\node.exe";
string pm2Path = $@"{folders.RoamingAppData}\npm\pm2"; //C:\Users\Administrator\AppData\Roaming\npm

string curDir = @"D:\RPA\XX";
string arg = """
start dist/index.js --name "AA"
"""
;

int r = run.console(pm2Path,arg, curDir); 
print.it(r);

There is still an error message using the following code.
-------------------------------------------------------------------------
C:\Users\Administrator\AppData\Roaming\npm\pm2:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
    at internalCompileFunction (node:internal/vm:128:18)
    at wrapSafe (node:internal/modules/cjs/loader:1280:20)
    at Module._compile (node:internal/modules/cjs/loader:1332:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.12.2
1

-------------------------------------------------------------------------
Code:
Copy      Help
// script "cmd3.cs"
//.
script.setup(trayIcon: true, sleepExit: true, exitKey: KKey.Pause);
//..
print.clear();

string nodePath = @"C:\Program Files\nodejs\node.exe";
string pm2Path = $@"{folders.RoamingAppData}\npm\pm2"; //C:\Users\Administrator\AppData\Roaming\npm

string curDir = @"D:\RPA\XX";
string arg = $"""
{pm2Path} start dist/index.js --name "AA"
"""
;

int r = run.console(nodePath, arg, curDir);
print.it(r);


Messages In This Thread
start App using command line parameters - by Davider - 05-08-2024, 02:52 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)