
NAME

  dkwt env - Modify environment variables

SYNOPSIS

  dkwt env         [<options>] <name> [<value>]
  dkwt environment [<options>] <name> [<value>]

DESCRIPTION

This function can modify environment variables, both system and
user variables.
This function is mainly intended for environment variables storing
names of directories or files (i.e. the PATH variable).
You can make sure a directory is listed in a variable by inserting
or appending the directory only if it is not yet present.

OPTIONS

-s
	Process system environment variables.
	Without this option the program processes the user environment.

-e
	When creating a new registry value, use type REG_EXPAND_SZ
	instead of default REG_SZ.
	This option is ignored when processing existing registry values.

-u
	Delete registry value completely, unset variable.

-i
	Ensure the variable lists the specified directory or file,
	insert at start if not present.

-a
	Ensure the variable lists the specified directory or file,
	append at end if not present.

-d
	Remove a directory or file from a variable listing one
	or multiple directories or files.
	If the variable value is empty after removal, the registry
	value is deleted.

RETURN VALUE

The program returns exit status code 0 on success, all other status
codes indicate an error.

EXAMPLES

Show value of user environment variable TEMP:

	dkwt env TEMP

Show value of system environment variable PATH:

	dkwt env -s PATH

Completely delete user environment variable FOO:

	dkwt env -u FOO

Completely delete system environment variable BAR:

	dkwt env -s -u BAR

Set user environment variable FOO:

	dkwt env FOO All text after variable name goes into value

Set system environment variable BAR:

	dkwt env -s BAR Same procedure for system variables

Make sure system PATH contains ``C:\Program Files\Nice Program''
(insert at start if not present):

	dkwt env -s -i Path C:\Program Files\Nice Program

Make sure system PATH contains ``C:\Program Files\Other Program''
(append at end if not present):

	dkwt env -s -a Path C:\Program Files\Other Program

Remove ``C:\Program Files\Nice Program'' from system PATH:

	dkwt env -s -d Path C:\Program Files\Nice Program

NOTES

``dkwt env'' does not change environment variables in cmd.exe windows
already opened.

AUTHOR

Dirk Krause

HISTORY

COPYRIGHT AND LICENSE

Run
  dkwt --license-terms
to see the license conditions.

SEE ALSO

http://dktools.sourceforge.net

