Folders

How to open .PS1 files (PowerShell scripts) on Android, Windows and Linux

What .ps1, .psm1, .bat, .cmd, .vbs and .reg files are, and how to open Windows scripts safely for free on Android, Windows and Linux without running them.

Cover: Folders' text editor on two phones, labelled .PS1

A forum answer says “just run this fix.ps1”, a game patch comes with install.bat, or a guide tells you to double-click a .reg file to change a Windows setting. Before you do any of that, it’s worth knowing what the file will do, and double-clicking is exactly the wrong way to find out.

All six of these are text files you can read. Folders opens PowerShell, batch, VBScript and registry files in its text editor on Android, Windows and Linux, and it never runs them. You see the commands; nothing happens to your system.

What is a .ps1 file?

A .ps1 file is a PowerShell script. PowerShell is Microsoft’s command shell and scripting language, built into Windows and also available for Linux. Scripts use commands such as Get-ChildItem or Set-ItemProperty to manage files, settings, apps and services.

The other files in this guide are Windows’ older ways of automating the same kind of work:

Extension Language or format What it’s for
.ps1 PowerShell script Automation and system settings
.psm1 PowerShell module Functions loaded with Import-Module
.bat Batch file Command Prompt commands, a format from the MS-DOS days
.cmd Batch file (Windows NT) The same as .bat, with small differences in error codes
.vbs VBScript Older automation through Windows Script Host
.reg Registry file Registry keys and values to add, change or delete

What matters most is what Windows does when you double-click each one:

  • .bat, .cmd and .vbs run straight away.
  • .reg asks you to confirm, then merges the file into the registry.
  • .ps1 opens in Notepad by default. Windows deliberately doesn’t run PowerShell scripts on a double-click.
  • .psm1 modules aren’t meant to be run on their own; scripts load them.

VBScript is on its way out: Microsoft has deprecated it and plans to remove it from a future version of Windows. It lingers in old login scripts, and in malware.

A .reg file starts with Windows Registry Editor Version 5.00, then lists keys in square brackets with values under them, like "HideFileExt"=dword:00000000. A key written as [-HKEY_...] deletes that whole key, and a value set to =- is deleted too.

How to open a .ps1 file with Folders

On Android

  1. Download Folders from the download section and install it on Android 7.0 or later.
  2. Open it, tap Allow access, and allow All files access.
  3. Find the script in Downloads or search for its name.
  4. Tap it. It opens as text; a phone can’t run Windows scripts anyway.

From an email or chat app, tap the attachment and choose Open with → Folders.

On Windows

  1. Install Folders with the Windows installer.
  2. Browse to the script inside Folders and double-click it. Folders opens it in the text editor; it doesn’t run it.
  3. For .psm1 modules, you can also right-click in File Explorer and choose Open with → Folders.

Windows keeps .ps1, .bat, .cmd, .vbs and .reg for itself, so the installer doesn’t add Folders to File Explorer’s Open with menu for those five. Open them from Folders instead.

On Linux

Install Folders (deb, rpm, AppImage, Flatpak, Snap or tar.gz), browse to the file and double-click it.

What you can do with it in Folders

  • Read PowerShell in colour. .ps1 and .psm1 files get colours for # comments, strings, numbers, keywords such as function, param and foreach, and $variables.
  • Read registry files in colour. .reg files are coloured like INI files: keys in brackets stand out from value names.
  • Plain text for batch and VBScript. .bat, .cmd and .vbs files open without colours, with line numbers and all the tools below.
  • Search for warning signs with Find. Things worth a closer look before running a script:
    • PowerShell: Invoke-Expression or iex fed by a download, -EncodedCommand with a long block of base64, anything that turns off Microsoft Defender;
    • batch: del /s /q, rd /s, format, reg delete, or certutil and bitsadmin used to download files;
    • VBScript: WScript.Shell running commands, especially with a hidden window;
    • registry: [-HKEY_...] lines that delete keys.
  • Edit and Save. Change a path or a setting, with undo and redo. Registry Editor exports .reg files as UTF-16, which Document info shows as “UTF-16 LE”, and Folders saves in the file’s own encoding and line endings.

Folders doesn’t run, check or sign scripts, and it doesn’t import .reg files into the registry.

Other ways to open .ps1 files

  • Notepad: right-click the file in File Explorer and choose Open with → Notepad, or Edit where it’s offered (on Windows 11 it may be under Show more options), to see the text without running it.
  • Visual Studio Code with Microsoft’s PowerShell extension, on Windows and Linux.
  • PowerShell ISE, the older script editor included with Windows PowerShell.
  • Notepad++, a free Windows editor with colours for batch and VBScript.

Problems opening a .ps1 file?

  • “Running scripts is disabled on this system.” That’s PowerShell’s execution policy. Downloaded scripts are also marked as coming from the internet. Read the script first; if you trust it, Unblock-File .\fix.ps1 removes the mark, and Set-ExecutionPolicy -Scope CurrentUser RemoteSigned allows local scripts.
  • A batch file flashes and closes. It ran and finished, or failed, too quickly to read. Open Command Prompt and run it from there to see the messages.
  • A batch file behaves strangely after editing elsewhere. Command Prompt can misread labels and goto in batch files saved with Unix (LF) line endings. Check the line endings in Document info.
  • “The specified file is not a registry script.” The first line must be the Windows Registry Editor Version 5.00 header (or REGEDIT4 in very old files), and the file must be saved in a supported encoding.

Questions people ask

Is a .bat file a virus? Not in itself, but it can run any command, including harmful ones. Open it as text first and check what it does.

How do I edit a .reg file without running it? Right-click it and choose Edit, or open it from Folders. Double-clicking merges it.

.bat vs .cmd: what’s the difference? Almost none. Both are Command Prompt scripts. .cmd arrived with Windows NT, and a few built-in commands set the error level slightly differently in it.

Can I run a .ps1 file on Linux or Android? PowerShell 7 runs on Linux, so many scripts work there unless they use Windows-only commands. Android can’t run them; Folders only shows the text.

For Linux and Unix scripts, see how to open .sh files. Settings files are covered in how to open INI and CONF files. And here are all 382 file types Folders opens.

Keep reading