Skip to content

Instantly share code, notes, and snippets.

@BlurryLight
Last active March 10, 2022 11:32
Show Gist options
  • Save BlurryLight/b94fad8b8a95ce147894055be45b7954 to your computer and use it in GitHub Desktop.
Save BlurryLight/b94fad8b8a95ce147894055be45b7954 to your computer and use it in GitHub Desktop.
profile
function Invoke-Environment {
# from https://github.com/majkinetor/posh/blob/master/MM_Admin/Invoke-Environment.ps1
param
(
# Any cmd shell command, normally a configuration batch file.
[Parameter(Mandatory=$true)]
[string] $Command
)
$Command = "`"" + $Command + "`""
cmd /c "$Command > nul 2>&1 && set" | . { process {
if ($_ -match '^([^=]+)=(.*)') {
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2])
}
}}
}
function set_lua_51
{
Set-Alias -name 'lua' -Value 'lua51.exe' -Scope GLobal
Set-Alias -name 'luarocks' -Value 'luarocks51.bat' -Scope GLobal
luarocks path > $env:TEMP\_lrp.bat
Invoke-Environment $env:TEMP\_lrp.bat
}
function set_lua_53
{
Set-Alias -name 'lua' -Value 'lua53.exe' -Scope GLobal
Set-Alias -name 'luarocks' -Value 'luarocks53.bat' -Scope GLobal
luarocks path > $env:TEMP\_lrp.bat
Invoke-Environment $env:TEMP\_lrp.bat
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment