Skip to content

Instantly share code, notes, and snippets.

@ubnt-intrepid
Created May 31, 2016 04:33
Show Gist options
  • Select an option

  • Save ubnt-intrepid/f6820c3896b7b87c8e8d8d9fd3f6cae7 to your computer and use it in GitHub Desktop.

Select an option

Save ubnt-intrepid/f6820c3896b7b87c8e8d8d9fd3f6cae7 to your computer and use it in GitHub Desktop.
PowerShell サンプル集
<#
.synopsis
Invoke batch file and apply the changes of all environment variables.
#>
param (
[string]
$batch
)
cmd /c "$batch & set" | & {
if ($_ -match '^(.*?)=(.*)$') {
$key, $value = $matches[1..2]
[Environment]::SetEnvironmentVariable($key, $value)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment