0

I've got used to pressing Ctrl+Shift+S to save all files in Visual Studio. PowerShell ISE doesn't recognise this key combination, and leaves my files edited without saving them.

This means that changes to my scripts aren't saved, and my scripts don't work.

Is there any way to add a Save All keybinding to PowerShell ISE?

Roger Lipscombe
  • 89,048
  • 55
  • 235
  • 380

1 Answers1

1

Add the following to your ISE profile file. It's in C:\Users\name\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1, by default, but you can find it in ISE by examining the $PROFILE variable.

function Save-All {
    $psISE.CurrentPowerShellTab.Files |
        where { ! $_.IsSaved } |
        foreach {
            $_.Save()
        }
}

$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add(
    "Save All", {Save-All}, "Ctrl+Shift+S")
Roger Lipscombe
  • 89,048
  • 55
  • 235
  • 380