134

All of us probably know .bat for Batch files.

But what is the file extension for PowerShell 3 scripts?

I found .ps1 and some other endings but they're only for version 1.

ComFreek
  • 29,044
  • 18
  • 104
  • 156

1 Answers1

160

PowerShell files for all versions are .ps1 (or .psm1, .psd1, etc.).

Mike Shepard
  • 17,466
  • 6
  • 51
  • 69
  • 15
    Update for 2014: This is still relevant now with Powershell 4. I think the 1 was really just to distinguish it from .ps (PostScript) files, but it made for a lot of confusion! – evilspoons Aug 20 '14 at 22:04
  • 1
    always wanted to know what the 1 meant. Guess it's not related to the version but pretty sure the had something to do with it when they created the file type for PS 1.0. – Geddon Sep 08 '14 at 18:45
  • 16
    @Geddon I once read somewhere that they chose `ps1` to avoid conflicts with `ps`, which was already in use by Adobe Photoshop. [Other sources](https://groups.google.com/d/msg/microsoft.public.windows.powershell/9rZosGOqodE/YEKubAR7f9UJ) say that versioning had been indeed the reason to call it `ps1`, but they dropped this idea when introducing PS 2 ([official source](http://blogs.msdn.com/b/powershell/archive/2007/11/02/ctp-versioning.aspx)). – ComFreek Sep 08 '14 at 18:52
  • 47
    This is a weird extension for sure. Why not .psh then?! – Barney Szabolcs Oct 26 '15 at 18:08
  • 8
    Just tried it out and it looks like `.psh` is used for HSLS sources in Visual Studio. Given that Microsoft develops VS, it seems likely that they went with `.ps1` also because of that reason. – Tom Connery Jul 16 '19 at 19:57
  • 1
    ps is a longstanding file extension for postscript files. – Mike Shepard Nov 27 '20 at 06:40
  • @zolty13 please read the first comment above – phuclv Aug 15 '22 at 15:24