npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mcswift/windows

v1.0.19

Published

[English](#english) | [中文](#中文)

Readme

@mcswift/windows

English | 中文


中文

提供针对 Windows 操作系统的专属工具方法,例如通过注册表和 PowerShell 获取系统已安装应用的信息。

安装

npm install @mcswift/windows
# or
pnpm add @mcswift/windows

使用指南及接口文档

1. 获取已安装的应用程序

通过读取 Windows 注册表 (App Paths),获取系统中已安装并在注册表中注册的应用程序列表及其可执行文件路径。

import { getInstalledApp, installedAppMap } from "@mcswift/windows";

async function fetchWindowsApps() {
  // 执行 PowerShell 命令并解析注册表信息
  const apps = await getInstalledApp();
  
  // apps 等同于 installedAppMap,返回一个 Map 对象
  // 键为程序名(不带后缀),值为程序的具体路径和后缀信息
  if (apps.has("chrome")) {
    console.log("Chrome 路径:", apps.get("chrome")?.path);
  }
  
  // 遍历所有获取到的应用
  for (const [name, info] of apps) {
    console.log(`${name}: ${info.path} (后缀: ${info.extension})`);
  }
}

fetchWindowsApps();

类型注释:

type InstalledAppRecord = {
  path: string;
  name: string;
  extension: string;
};

type InstalledAppMap = Map<string, InstalledAppRecord>;

const installedAppMap: InstalledAppMap;
const getInstalledApp: () => Promise<InstalledAppMap>;

2. 内置的 PowerShell 命令串

你也可以直接获取并使用库中内置的 PowerShell 原始命令字符串:

import { getInstalledAppCommand } from "@mcswift/windows";

// 返回拼接好的 PowerShell 命令字符串,用于查询 App Paths
console.log(getInstalledAppCommand);

类型注释:

const getInstalledAppCommand: string;

English

Provides specific utility methods for the Windows operating system, such as retrieving information about installed applications via the Registry and PowerShell.

Installation

npm install @mcswift/windows
# or
pnpm add @mcswift/windows

Usage Guide & API Documentation

1. Get Installed Applications

By reading the Windows Registry (App Paths), this function retrieves a list of applications installed and registered in the system, along with their executable file paths.

import { getInstalledApp, installedAppMap } from "@mcswift/windows";

async function fetchWindowsApps() {
  // Execute PowerShell command and parse registry information
  const apps = await getInstalledApp();
  
  // `apps` is equivalent to `installedAppMap`, returning a Map object
  // Key is the program name (without extension), value is the specific path and extension info
  if (apps.has("chrome")) {
    console.log("Chrome path:", apps.get("chrome")?.path);
  }
  
  // Iterate through all fetched applications
  for (const [name, info] of apps) {
    console.log(`${name}: ${info.path} (Extension: ${info.extension})`);
  }
}

fetchWindowsApps();

Type Annotations:

type InstalledAppRecord = {
  path: string;
  name: string;
  extension: string;
};

type InstalledAppMap = Map<string, InstalledAppRecord>;

const installedAppMap: InstalledAppMap;
const getInstalledApp: () => Promise<InstalledAppMap>;

2. Built-in PowerShell Command Strings

You can also directly access and use the built-in raw PowerShell command strings provided by the library:

import { getInstalledAppCommand } from "@mcswift/windows";

// Returns the concatenated PowerShell command string used to query App Paths
console.log(getInstalledAppCommand);

Type Annotations:

const getInstalledAppCommand: string;