Skip to main content

windows env

Project description

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.

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.3-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: win_all_env-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.9 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 da2254c310b47f66cc0600ab5eae14f563cd8bcec22399edd3f52591e0d5cbfa
MD5 6b8ff021fc712d716fb4fc1436805305
BLAKE2b-256 e4a0f2b81732fbf7760c5ccf4dd67f6d4cac8f4a2e7caba12f089a8f837be14b

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