aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/README.md
blob: 00d62c412ff7420ad676173da2299fb8e0b70685 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Windows environment variables
=============================

A collection of simple programs to manage environment variables on Windows,
created mainly to:

* learn a bit of Haskell,
* make it easier to add paths to the `PATH` variable, automatically setup
`_NT_SYMBOL_PATH`, etc.

Building
--------

Using [stack]:

    stack build

[stack]: http://docs.haskellstack.org/en/stable/README/

Installation
------------

    stack install

Usage
-----

The complete list of utilities is given below.

* [list_path](#list_path) — List directories in your `PATH`.
* [add_path](#add_path) — Add directories to your `PATH`.
* [remove_path](#remove_path) — Remove directories from your `PATH`.
* [set_env](#set_env) — Set environment variable.
* [unset_env](#unset_env) — Unset environment variable.

Pass the `--help` flag to a utility to examine its detailed usage information.
Some examples are given below.

### list_path

List directories in your `PATH` variable:

```
> list_path
- C:\Program Files\Haskell\bin
+ C:\Program Files\Haskell Platform\8.0.1\lib\extralibs\bin
+ C:\Program Files\Haskell Platform\8.0.1\bin
+ C:\Users\Egor\AppData\Roaming\local\bin
- C:\Users\Egor\AppData\Roaming\cabal\bin
...
```

Lines starting with `+` denote existing directories.
Conversly, lines starting with `-` denote missing directories.

### add_path

Add "C:\test" to current user's `PATH`:

```
> add_path C:\test
Saving variable 'PATH' to 'HKCU\Environment'...
        Old value: C:\Users\Egor\AppData\Roaming\local\bin;C:\Users\Egor\AppData\Roaming\cabal\bin
        New value: C:\Users\Egor\AppData\Roaming\local\bin;C:\Users\Egor\AppData\Roaming\cabal\bin;C:\test
Continue? (y/n) y

>
```

### remove_path

Remove "C:\test" from both current user's and global `PATH`s, skipping the
confirmation prompt:

```
> remove_path --global -y C:\test
```

### set_env

Assign `bar` to the variable `foo` for all users:

```
> set_env -g foo bar
Saving variable 'foo' to 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'...
        Value: bar
Continue? (y/n) y

>
```

### unset_env

Unset the variable `foo` for current user, skipping the confirmation prompt:

```
> unset_env --yes foo
```

License
-------

This project, including all of the files and their contents, is licensed under
the terms of the MIT License.
See [LICENSE.txt] for details.

[LICENSE.txt]: LICENSE.txt