What a PS1 file is and why you might have one

A PS1 file is a PowerShell script — a text file containing commands that Windows PowerShell (or PowerShell Core on Mac and Linux) can read and execute. You might have one because you downloaded a tool, received one from a colleague, found one in a software package, or created one yourself to automate a task on your computer.

PS1 files are plain text, so you can open and read them in any text editor before running them. This matters because running a script from an unknown source can let that script do things to your computer — install software, change settings, delete files — so looking at what it actually does first is a real safety step, not paranoia.

Key Takeaways

  • PS1 files run in PowerShell, which you already have on Windows; Mac and Linux users need to install PowerShell Core first.
  • Windows blocks PS1 files from running by default as a safety measure, so you may need to change your execution policy or right-click and choose "Run with PowerShell".
  • Before running any PS1 file, open it in Notepad or another text editor to read what commands it contains.
  • If a PS1 file needs administrator permissions to work, you must right-click PowerShell itself and choose "Run as administrator" before running the script.

Running a PS1 file on Windows

The simplest method on Windows is to right-click the PS1 file, then select "Run with PowerShell" from the menu. PowerShell will open, run the script, and show you any output or errors. This works for most scripts that don't need administrator access.

If that option doesn't appear, or if the script needs administrator permissions, open PowerShell as administrator first. Click the Windows Start button, type "PowerShell", right-click "Windows PowerShell", and select "Run as administrator". Then type the full path to your PS1 file in quotes, like this: & "C:\Users\YourName\Downloads\script.ps1" and press Enter. Replace the path with wherever your file actually sits.

If PowerShell refuses to run the file and shows an error about execution policy, Windows is blocking it intentionally. You have two options: change the policy for just that one script, or change it system-wide. For a single script, right-click the PS1 file, select Properties, check the box that says "Unblock" at the bottom of the window, click Apply, then click OK. Now try running it again.

Running a PS1 file on Mac or Linux

Mac and Linux don't come with PowerShell, so you need to install PowerShell Core first. Go to microsoft.com/powershell, download the version for your operating system, and follow the installer. Once installed, open Terminal, navigate to the folder where your PS1 file sits (use the cd command), then type pwsh script.ps1 and press Enter, replacing "script.ps1" with your actual filename.

If you get a permission error, the file may not have execute permission. Type chmod +x script.ps1 first, then try running it again.

Reading a PS1 file before you run it

Open the PS1 file in Notepad, VS Code, or any text editor to see what it actually does. Look for commands that seem suspicious: anything that deletes files, changes Windows settings, installs software, or creates user accounts. If you don't recognize what a command does, search for it online before running the script.

Common safe commands include things like copying files, creating folders, or reading information from your system. Commands that start with "Remove-", "Uninstall-", or "Set-" often make permanent changes, so pay attention to those. If the script is from someone you trust and does something you understand, you're probably safe to run it.

Fixing common errors when running PS1 files

"Cannot be loaded because running scripts is disabled": Windows is blocking the script. Use the Unblock method described above, or open PowerShell as administrator and type Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser, then press Enter and type "Y" to confirm. This allows scripts you've downloaded to run, but still blocks obviously dangerous ones.

"The term is not recognized": PowerShell can't find the file because the path is wrong. Make sure you're typing the full path in quotes, or navigate to the folder first using cd, then type just the filename.

"Access denied": The script needs administrator permissions. Close PowerShell, right-click it, select "Run as administrator", then try running the script again.

Understanding execution policy and when to change it

Execution policy is Windows's way of saying "I don't trust scripts by default". The default setting, Restricted, blocks all scripts from running. RemoteSigned allows scripts you created or downloaded and unblocked to run, but still blocks scripts that came in an email or from the internet without your permission. Unrestricted allows any script to run, which is why it's not recommended.

You can set execution policy for just your user account (which is safer) or for the whole computer. For your account only, open PowerShell as administrator and type Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser. For the whole computer, type Set-ExecutionPolicy -ExecutionPolicy RemoteSigned instead. Either way, type "Y" and press Enter to confirm.

Frequently Asked Questions

Can I run a PS1 file by double-clicking it?

Not usually. Windows is set up to open PS1 files in a text editor by default, not run them. You need to right-click and choose "Run with PowerShell", or open PowerShell and type the path to the file. This is intentional — it's a safety feature to keep you from accidentally running something dangerous.

What's the difference between PowerShell and Windows PowerShell?

Windows PowerShell is the older version built into Windows. PowerShell Core is the newer version that runs on Windows, Mac, and Linux. For most scripts, either one works. If you're on Mac or Linux, you need PowerShell Core. On Windows, Windows PowerShell is fine unless the script specifically requires PowerShell Core.

Is it safe to run a PS1 file I found online?

Only if you trust the source and you've read the file to understand what it does. A PS1 file can do anything your user account can do — install software, change settings, delete files. If you don't recognize the commands or don't know why you need the script, don't run it. When in doubt, ask the person who gave it to you what it does.

Can I edit a PS1 file to remove parts I don't trust?

Yes. Open it in a text editor, delete the lines you don't want, save it, then run it. Be careful not to break the syntax — if you're not sure what a line does, leave it alone or search for the command online first. If you remove something important, the script might not work the way it's supposed to.