Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. param([string] $script, [string] $parameters)
  2.  
  3. $temp = [IO.Path]::GetTempFileName()
  4.  
  5. cmd /c " `"$script`" $parameters && set > `"$temp`" "
  6.  
  7. Get-Content $temp | Foreach-Object {
  8. if($_ -match "^(.*?)=(.*)$")
  9. {
  10. Set-Content "env:\$($matches[1])" $matches[2]
  11. }
  12. }
  13.  
  14. Remove-Item $temp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement