PoshCode Logo PowerShell Code Repository

Save-CurrentFile (ISE) by Bernd Kriszio 29 months ago
embed code: <script type="text/javascript" src="http://PoshCode.org/embed/1318"></script>download | new post

Why to use a FileselectionBox to save your fresh files from ISE, don’t you know your file system? OK perhaps an encoding parameter would be fine, but please don’t default it to ASCII.

  1. function Save-CurrentFile ($path)
  2. {
  3.     $psISE.CurrentFile.SaveAs($path)
  4.     $psISE.CurrentFile.Save([Text.Encoding]::default)
  5.  
  6. }
  7.  
  8. # Save-CurrentFile '.\Save-CurrentFile.ps1'

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:


Remember me