You may want to turn on and off the PATH
environment variable, for example, when you use UNIX tools with MSYS2.
It's annoying like this.
» $prevPath = $Env:Path
» $Env:Path = "$Env:MSYS2\bin;$Env:MSYS2\mingw64\bin;$Env:Path"
» # do some work with MSYS2
» $Env:Path = $prevPath
Or you may want to change each version of compilers.
powershell-path-switcher supports this.
kakkun61
/
powershell-path-switcher
Path Environment Variable Quick Switcher
powershell-path-switcher
Path Environment Variable Quick Switcher.
JFyT6Gn0gm2n2m60.mp4
Install
Invoke the following commands to install this.
> Install-Module path-switcher
> Import-Module path-switcher
HEAD
If you want to use HEAD, follow this instruction.
> git clone git@github.com:kakkun61/powershell-path-switcher.git
> Import-Module .\powershell-path-switcher\path-switcher.psd1 # -Force option may be necessary
Configuration
This module treats three types of configurations:
- local configuration
- user global configuration
- system global configuration
Local configuration
A local configuration is named powershell-path-switcher.yaml and located at the current working directory or its parents recursively.
User global configuration
A user global configuration is named config.yaml and located at $Env:APPDATA\powershell-path-switcher
.
System global configuration
A system global configuration is named config.yaml and located at $Env:ProgramData\powershell-path-switcher
.
Overwriting
When the configurations have the same keys, upper ones overwrite.
For example there are following configurations:
# local configuration
foo:
…Interactive select
A quick view is at this video.
Prepare a configuration file,
# $Env:ProgramData\powershell-path-switcher\config.yaml
msys2-usr: C:\tools\msys64\usr\bin
msys2-mingw64: C:\tools\msys64\mingw64\bin
and invoke Switch-Path
.
» Switch-Path
> [ ] msys2-usr: C:\tools\msys64\usr\bin
[ ] msys2-mingw64: C:\tools\msys64\mingw64\bin
You can move its cursor (>
) up/down with ↑/↓ keys, select (check by x
) with the space key and reflect with the enter key.
When you want to remove a specified path from the PATH
variable, you can delete it by removing its check mark (x
).
For more information see a README.
Top comments (0)