0.1.3 • Published 10 months ago

windows-reg v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

windows-reg

Access Windows registry with REG command line tool

Getting Started

yarn add windows-reg

To Read a Single Registry Key Value

import { query } from 'windows-reg';

console.log(
  await query(
    'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run',
    'OneDrive',
  ),
);

The example output would be

{
  valueName: 'OneDrive',
  valueType: 'REG_SZ',
  value: '"C:\\Program Files\\Microsoft OneDrive\\OneDrive.exe" /background'
}

To Read All Values under a Registry Key Recursively

import { queryAll } from 'windows-reg';

console.log(
  await queryAll(
    'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run',
    true,
  ),
);

The example output would be

{
  'HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run': [
    {
      valueName: 'OneDrive',
      valueType: 'REG_SZ',
      value: '"C:\\Program Files\\Microsoft OneDrive\\OneDrive.exe" /background'
    },
    {
      valueName: 'Docker Desktop',
      valueType: 'REG_SZ',
      value: 'C:\\Program Files\\Docker\\Docker\\Docker Desktop.exe -Autostart'
    },
    ...
  ],
  'HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\ExampleSubKey': [
    {
      valueName: 'ExampleBinaryValue',
      valueType: 'REG_BINARY',
      value: <Buffer ad fa df ad fa df ad fa dc ae fa df ea e2 31 3f 23 23 e2 da fd af>
    },
    {
      valueName: 'ExampleNumberValue',
      valueType: 'REG_QWORD',
      value: 1672226
    },
    ...
  ],
}

Developing

Available Scripts

In the project directory, you can run:

yarn lint

To lint the code and list the existing issues.\ Usually VSCode will format the code when saving.

yarn build

Builds the library for publishing to the dist folder.

yarn test

Run the tests. Attaching --watch to watch the file changes.

Developer Support

ESlint, prettier and husky are hooked into the normal developing flows.

License

Licensed under MIT.

0.1.3

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago