2

I am using child_process to launch software from Windows clients connected on my server. The general cases are working like a charm but in one I have a "&" sign which fails the command to launch.

Is there a way to escape this kind of special char ?

Here is a example of my command:

var exec = require('child_process').exec, child;
child = exec('C:/Programs/program.exe /Callback:other&program.exe /Start');

There is one constraint: I cannot use /Callback:"other&program.exe" because program.exe is no to smart to escape the " signs

3
  • Try pass /Callback:other&program.exe /Start as options (array) to exec. Commented Aug 3, 2016 at 18:35
  • as you can see in documentation, options is not used for command parameters but for exec specific options. Commented Aug 3, 2016 at 19:26
  • 1
    Yeah. Your answer is here - stackoverflow.com/questions/1327431/… . Use ^ to mask ampersand &. Commented Aug 3, 2016 at 20:00

1 Answer 1

3

As Aikon Mogwai said (thanks to him):

Use ^ to mask ampersand &.

This is working for child_process exec command.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.