Closed elbehery95 closed 7 years ago
I adopt your modify and add some improvement, like this:
let command = "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe";
let powershellExisted = fs.existsSync(command)
if (!powershellExisted) {
command = "powershell"
}
const powershell = spawn(command, [
'-noprofile',
'-noninteractive',
'-nologo',
'-sta',
'-executionpolicy', 'unrestricted',
'-windowstyle', 'hidden',
'-file', scriptPath,
imagePath
]);
powershell.on('error', function (e) {
if (e.code == "ENOENT") {
Logger.showErrorMessage(`The powershell command is not in you PATH environment variables.Please add it and retry.`);
} else {
Logger.showErrorMessage(e);
}
});
detail: Paste fail when powershell not in PATH on windows · mushanshitiancai/vscode-paste-image@14a7065
Thank you for you mr very much!
Great, thanks so much :)
Exception thrown when users did not set powershell in windows environmental variables, this causes the powerscript that paste images to not work at all.
Issue#12