Skip to main content

windows env

Project description

win_all_env 1.1.1

This is a library that allows you to display and set Windows system environment variables and user environment variables.

Description

This module uses the winreg module to edit the location of environment variables.

Usage

env_type

win_env.user

Specifies the user environment variables.

win_env.systems

Specifies the system environment variables.

win_env.custom

Think of it as a carry-over variable. It's stored in a Registry so it can be easily seen from outside.

Registry location: HKEY_CURRENT_USER\Software\python-lib\3.12\win_env\custom_env

win_env.volatile (beta)

Specifies a volatile environment variable. There seems to be a bug in Windows so it may not work properly.

write_mode

1

Write it in REG_SZ format, not in list format, which indicates that you haven't specified a location.

2

Specify 2 to specify location or list format, written as REG_EXPAND_SZ.

Multiple Placement Commands

win_env.open(env_type)

You can use either a variable or with.

Available commands

list(only=None)

Same as list command

get(key)

Same as get command

set(key, value, write_mode=1)

Same as set command

dels(key)

Same as dels command

add(key, value, write_mode=1)

Same as add command

Single command

win_env.list(env_type, only=None)

Lists the contents of the environment variables.

Only args: False will return a list of just the values, True will return just the keys, None will return both.

only

False returns a list of only the values. True returns only the keys. defolt = None

win_env.get(env_type, key)

Displays the contents of the environment variable named key.

win_env.set(env_type, key, value, write_mode)

Write the environment variables.

Note: Run as administrator to write system environment variables.

win_env.all_list()

Returns all environment variables as a dictionary+list.

win_env.dels(env_type, key)

Removes an environment variable. Returns Env NotFoundError of the environment variable does not exist.

Note: Admin privileges are required for system environment variables.

win_env.add(env_type, key, value, write_mode)

Adds the environment variable if it doesn't exist, raises an EnvError if it does exist.

How to install

pip install git+https://github.com/akino11/win_env.git

in the command prompt.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

win_all_env-1.1.1-py3-none-any.whl (36.2 kB view details)

Uploaded Python 3

File details

Details for the file win_all_env-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: win_all_env-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 36.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for win_all_env-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e6144963021e31f38b87437e9d1bbb6802b30c593402c67853c014f1fee2e250
MD5 5cd56a2ad95b2ab80f42208a593eeeeb
BLAKE2b-256 54c16f34647b49b08b29afbc2afa286d974affb53b6bc914ce06c726e26c9502

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page