Skip to content

Instantly share code, notes, and snippets.

View janisblaus's full-sized avatar

Jānis Blaus janisblaus

  • Latvia, Riga
View GitHub Profile
const { exec } = require('child_process');
const desiredArgument = 'your_argument';
exec(`wmic process where "CommandLine like '%%%${desiredArgument}%%%' and not CommandLine like '%%wmic%%'" get ProcessId`, (error, stdout) => {
if (error) {
console.error(`Error: ${error.message}`);
return;
}