What is PWSH.EXE?

Before we start, let’s clear out one detail. PWSH.EXE is the new name for PowerShell. Since version 6 it is called PowerShell Core.  It was earlier named as powershell.exe which you must have seen installed in Windows (version 5.1).  No wonder every time you launch PowerShell in Windows, you get a message: You can read about the difference between PowerShell and PowerShell Core. Fast forward today, PowerShell has reached version 7 which is a major change compared to version 6 and uses .NET Core 3 instead of the .Net Framework. If you want to give it a try, learn how to install PowerShell 7.0 on Windows 10.

Important PWSH Syntax

-File | -f: If you have commands into a script file, you can use it as an input. You can also arguments for the files when applicable. -Command | -c: Use this to execute a command or ScriptBlock. ScriptBlock is set of functions enclosed withing {} or -EncodedCommand | -e | -ec: Use this when there is a need to use complex quotation marks or curly braces. -Login | -l: On Linux and macOS, starts PowerShell as a login shell, using /bin/sh to execute login profiles such as /etc/profile and ~/.profile.  It is not applicable to Windows. You will have to verify the absolute path listed under /etc/shells. You can use the chsh utility to set your current user’s shell to pwsh.

-SettingsFile | -settings

If you want to overwrite the global settings with local project settings, then you can specify the settings file using this option. The system-wide settings are available in powershell.config.json.

Complete List of PWSH Syntax

If you need more details, you can visit docs.microsoft.com.

What is PWSH EXE  List of PWSH syntax you can use - 58What is PWSH EXE  List of PWSH syntax you can use - 73