Skip to main content

win_all_env 1.1.3

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.

Metadata

Release files for win-all-env 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for win-all-env 1.1.3
File Interpreter ABI Platform
win_all_env-1.1.3-py3-none-any.whl Python 3 none any Details

Release files / win_all_env-1.1.3-py3-none-any.whl

Download URL win_all_env-1.1.3-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da2254c310b47f66cc0600ab5eae14f563cd8bcec22399edd3f52591e0d5cbfa
BLAKE2b-256 checksum
How to use checksums
e4a0f2b81732fbf7760c5ccf4dd67f6d4cac8f4a2e7caba12f089a8f837be14b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.1.3 This release

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.3

1 release file

1.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page