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. It is not a video game file, despite the name. Someone created it to automate a task, configure settings, or run a series of programs in sequence.
You might have received a PS1 file from a software installer, a system administrator, a tutorial you followed online, or a batch of scripts meant to set up your computer. The file itself is just text, but PowerShell interprets those commands and carries them out.
Key Takeaways
- PS1 files run in PowerShell, which is built into Windows but requires setup on Mac and Linux.
- Windows blocks PS1 files by default for security — you must change your execution policy before the first run.
- The safest approach is to open PowerShell as administrator, change the policy for that session only, then run the file.
- If you do not trust the source of a PS1 file, open it in Notepad first to read what commands it will execute.
- After running the file, you can restore the default security setting to prevent accidental execution of unknown scripts.
How to run a PS1 file on Windows
Windows blocks PS1 files from running by default. This is a security measure — it prevents malicious scripts from executing without your knowledge. To run a PS1 file, you must first change the execution policy for your current PowerShell session.
Step 1: Open PowerShell as administrator. Right-click the Start button, select "Windows PowerShell (Admin)" or "Terminal (Admin)" if you have Windows 11. If you see "Windows Terminal" in the menu, open that and then select the PowerShell tab at the top.
Step 2: Change the execution policy for this session only. Type this command exactly and press Enter:
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
PowerShell will ask you to confirm. Type Y and press Enter. This change applies only to the current PowerShell window — it does not affect future sessions or other users on the computer.
Step 3: Navigate to the folder containing your PS1 file. Type cd followed by the path to the folder. For example, if your file is on your Desktop:
cd C:\Users\YourUsername\Desktop
Replace "YourUsername" with your actual Windows username. Press Enter.
Step 4: Run the file. Type a period, a backslash, and the filename:
.\filename.ps1
Replace "filename" with the actual name of your PS1 file. Press Enter. The script will now execute.
Reading a PS1 file before you run it
If you are not certain what a PS1 file does, open it in Notepad before running it. Right-click the PS1 file, select "Open with," and choose Notepad. You will see the commands the script contains.
PowerShell commands often look like English words — you might see "Remove-Item," "Copy-Item," "Get-Process," or "Stop-Service." If you see commands that delete files, disable security features, or install software you do not recognize, do not run the file. Close Notepad and delete the file if you do not trust its source.
If the file contains only a few lines and they match what you expected (for example, a tutorial told you the script would install a specific program), it is usually safe to proceed. When in doubt, ask the person or organization that gave you the file what it does.
Running a PS1 file on Mac or Linux
PowerShell is not installed by default on Mac or Linux, but you can install PowerShell Core, which is Microsoft's cross-platform version. Download it from the official PowerShell GitHub releases page and follow the installer for your operating system.
Once PowerShell Core is installed, open Terminal and navigate to the folder containing your PS1 file using the cd command, just as you would on Windows. Then run the file with:
./filename.ps1
On Mac and Linux, the execution policy is less restrictive by default, so you may not need to change it. If PowerShell refuses to run the file, use the same Set-ExecutionPolicy command shown above.
Restoring the default security setting
After you finish running your PS1 file, you can restore Windows to its default security setting. This prevents accidental execution of unknown scripts in the future. Open PowerShell as administrator again and type:
Set-ExecutionPolicy -ExecutionPolicy Restricted -Scope Process
Press Enter and confirm with Y. This restores the block for the current session. The next time you open PowerShell, the default restriction will be in place again.
If you plan to run PS1 files regularly, you might prefer to change the policy permanently for your user account instead. Use this command:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
This allows locally created scripts to run but still blocks scripts downloaded from the internet unless they are digitally signed. This is a middle ground between total restriction and total openness.
Troubleshooting common problems
PowerShell says "file not found." You typed the filename wrong, or you are in the wrong folder. Use the dir command to list all files in the current folder and check the exact spelling of your PS1 file.
The script runs but nothing seems to happen. Some PS1 files run silently in the background. Check whether the task you expected actually completed — for example, if the script was supposed to create a folder, look for it in the location the script specified. If you are unsure, open the file in Notepad and read the commands to understand what it should do.
PowerShell shows an error message partway through. The script encountered a problem and stopped. Read the error message carefully — it usually tells you what went wrong. Common causes are missing files, incorrect paths, or permissions issues. If the error mentions a file path, make sure that file or folder actually exists on your computer.
You cannot open PowerShell as administrator. Your user account may not have administrator rights. Contact the person who manages your computer, or try right-clicking PowerShell and selecting "Run as administrator" instead of using the Start menu.
Frequently Asked Questions
Is it safe to run a PS1 file I found online?
Not automatically. Open the file in Notepad first and read the commands. If you do not recognize what the commands do, search for them online or ask in a tech forum before running the file. Only run scripts from sources you trust.
Can I run a PS1 file by double-clicking it?
No. Windows blocks PS1 files from running when you double-click them, even if you have changed the execution policy. You must open PowerShell and run the file from the command line using the method described above.
What does "execution policy" mean?
Execution policy is a PowerShell security setting that controls which scripts are allowed to run. "Restricted" blocks all scripts. "Bypass" allows all scripts. "RemoteSigned" allows local scripts but blocks downloaded ones unless they are signed by a trusted publisher.
Will changing the execution policy affect other programs on my computer?
No. Execution policy only controls PowerShell. It does not affect other programs, installers, or system settings. Changing it to "Bypass" for a single session affects only that PowerShell window.
Can I run a PS1 file on a Mac without installing PowerShell Core?
No. PS1 files are PowerShell scripts and require PowerShell to run. Mac comes with a different shell called Bash. You must install PowerShell Core first.