logo
Search
showing results for - "run command line using javascript"
Hallie
10 Nov 2016
1const { exec } = require("child_process");
2
3exec("ls -la", (error, stdout, stderr) => {
4    if (error) {
5        console.log(`error: ${error.message}`);
6        return;
7    }
8    if (stderr) {
9        console.log(`stderr: ${stderr}`);
10        return;
11    }
12    console.log(`stdout: ${stdout}`);
13});
14
source
similar questions
node execute shell commandsjavascript run commandcli run jsjavascript shellhow to run javascript in terminalnode run commandexecute bash program using jsexecute terminal command nodejsrun code in javascriptbash commands in nodehow to run commands in the command prompt using javascriptjavascript run functionhow to create a js file in windows command prompt codejavascript execute cmdhow to use the javascript console
queries leading to this page
how to run command in console using javascriptexecute cmd commands javascriptcall command line from javascript examplesjscript run command linecommand line how to execute command on cli in javascript linuxjavascript execute commandnods js execute commandrun cmd command using javascriptrun cmd command in javascriptexecute command in javascriptrun cmd commands from jsrun command line using javascript
privacy policyterms of useinstagram
Crafted with  ♥  for everyone

sign in to continue
your answer for
you will get a confirmation link on this - you will have to click that for successful submission of your answer. we require this to keep the website free of spam, bots and unhelpful content
please ensure to add code which is syntactically corrent and executes properly
sign in to continue
ask question on maxinterview
you will get a confirmation link on this - you will have to click that for successful submission of your question. we require this to keep the website free of spam, bots and unhelpful content
please be clear, to the point and respectful
sign in to continue