https://github.com/vweevers/windows-env
Normalized environment variables for Windows XP and up
https://github.com/vweevers/windows-env
Last synced: 12 months ago
JSON representation
Normalized environment variables for Windows XP and up
- Host: GitHub
- URL: https://github.com/vweevers/windows-env
- Owner: vweevers
- License: mit
- Created: 2016-03-12T12:47:21.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-12T16:38:15.000Z (over 10 years ago)
- Last Synced: 2025-03-28T21:39:08.093Z (about 1 year ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# windows-env
**Normalized environment variables for Windows XP and up.**
[](https://www.npmjs.org/package/windows-env) [](https://ci.appveyor.com/project/vweevers/windows-env) [](https://david-dm.org/vweevers/windows-env)
## example
```js
const env = require('windows-env')
console.log('32-bit Program Files: %s', env.PROGRAMFILES_X86)
// This is true even if you run it with 32-bit Node.js
if (env.X64) {
console.log('64-bit Program Files: %s', env.PROGRAMFILES_X64)
}
```
## exports
All of `process.env` uppercased, and:
- `PROGRAMFILES_X86`: `C:\Program Files (x86)` on 64 bit Windows, else `C:\Program Files`
- `PROGRAMFILES_X64`: `C:\Program Files` on 64 bit Windows, else undefined
- `USERPROFILE`: `USERPROFILE` or `HOMEDRIVE` + `HOMEPATH`
- `LOCALAPPDATA`: this is usually `USERPROFILE\AppData\Local`, falls back to `USERPROFILE\Local Settings\Application Data` for Windows XP
- `X64`: true on 64 bit Windows, regardless of node's bitness
## install
With [npm](https://npmjs.org) do:
```
npm install windows-env
```
## license
[MIT](http://opensource.org/licenses/MIT) © Vincent Weevers