ResetEnvironment.ps1 926 B

1234567891011121314151617181920212223242526272829303132
  1. <#
  2. .SYNOPSIS
  3. Resets changes made by ConfigureEnvironment.pst to the current PowerShell environment.
  4. .DESCRIPTION
  5. Optional script to undo changes to the current session made by ConfigureEnvironment.ps1.
  6. Changes only affect the current session, so exiting will also "reset."
  7. .PARAMETER Exit
  8. Switch parameter that, if specified, exits the current PowerShell environment.
  9. Does not bother doing any other operations, as none are necessary.
  10. .INPUTS
  11. None
  12. .OUTPUTS
  13. None
  14. .EXAMPLE
  15. .\ResetEnvironment.ps1
  16. To run the script to undo changes in the current session.
  17. .EXAMPLE
  18. .\ResetEnvironment.ps1 -Exit
  19. To exit the current session. Same as simply using the Exit command.
  20. #>
  21. # The two blank lines above must be preserved.
  22. Import-Module ./Terminal.Gui.PowerShell.psd1
  23. if($args -contains "-Exit"){
  24. [Environment]::Exit(0)
  25. } else {
  26. Reset-PowerShellEnvironment
  27. }
  28. Remove-Module Terminal.Gui.PowerShell