📄 JScript (WSH)

Get Startup Programs Report (JScript)

Queries Win32_StartupCommand via WMI and prints Startup Programs to the console — JScript, VBScript's WSH sibling language.

By WindowsScripting.com · 1021 B
GetStartupCommandReport.js
// ============================================================
// GetStartupCommandReport.js
//
// Reports Startup Programs via WMI (Win32_StartupCommand). JScript (Windows Script Host) —
// VBScript's sibling language, run the same way via cscript/wscript.
//
// Usage: cscript GetStartupCommandReport.js
// ============================================================

var objWMIService = GetObject("winmgmts:\\\\.\\root\\cimv2");
var colItems = objWMIService.ExecQuery("SELECT Name, Command, Location, User FROM Win32_StartupCommand");

var e = new Enumerator(colItems);
var output = "";
var count = 0;

for (; !e.atEnd(); e.moveNext()) {
    var item = e.item();
    output += "Name: " + item.Name + "\n";
    output += "Command: " + item.Command + "\n";
    output += "Location: " + item.Location + "\n";
    output += "User: " + item.User + "\n";
    output += new Array(41).join("-") + "\n";
    count++;
}

if (count === 0) {
    WScript.Echo("No Startup Programs found.");
} else {
    WScript.Echo(output);
}