0

I'm running where *.exe to list all the exe from windows in electron application.and then launch some apps.It returns result in Uint8Array format.

const { execSync } = require('child_process');
const exeFiles=execSync('where *.exe');
console.log( exeFiles); // this returns [97, 92,79,....]
console.log(exeFiles.toString());
// returns
//C:\Windows\System32\cacls.exe                                                                                           //C:\Windows\System32\calc.exe...        

I want result to be

[C:\Windows\System32\cacls.exe,C:\Windows\System32\calc.exe,...]        

1 Answer 1

1

if you want the result as an array, you can split the string based on the newline character and remove the last element

const resultArray = exeFiles.toString().split("\n")
resultArray.pop() // since last element will be empty string
console.log(resultArray);
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.