October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Redmond desk3 min

How to Create a Program Alias in PowerShell, Bash, or Windows

“Program alias” can mean several different things. Learn which Windows or shell method fits, how to make a PowerShell alias persist, and when a function is needed.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

There is no single system-wide setting called a “program alias.” The right method depends on where you want to type the shortcut: in PowerShell, in Bash, in Windows Shell app lookup, or to launch a packaged Windows app. For a quick command-line shortcut, use a shell alias; if it needs fixed arguments, use a function instead.

Choose the right kind of alias

Where you want to use it Use Scope and persistence Can include arguments?
PowerShell command prompt PowerShell alias, or a function if arguments are needed Current session; load the definition from a profile for later sessions No for aliases; yes for functions
Bash interactive command line Alias for simple substitutions; function for argument handling Interactive shell; define it in a shell startup file to reuse it No for aliases; yes for functions
Windows Shell application lookup App Paths registry entry Per-user or per-machine registration Not a shell alias; maps an executable name to its path
Packaged Windows app Execution alias declared in the app package manifest Configured by the app developer in the package Not a user-created shell alias

Create a PowerShell alias for an executable

In PowerShell, Set-Alias can map a short command name to an executable. For example:

Set-Alias -Name editor -Value 'C:Program FilesExample Editoreditor.exe'

Replace the example path with the executable’s actual full path. Quote a path containing spaces. The alias is available in the current PowerShell session. Microsoft’s Set-Alias documentation describes it as creating or changing an alias for a command, file, or executable.

Make the alias persist

To have it in future sessions, put the definition in the PowerShell profile that is loaded by the host you use. Open the profile in that host with:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
notepad $PROFILE

Add the Set-Alias line, save the file, then open a new PowerShell session. PowerShell profiles are host-specific, so a profile used by one host may not be loaded by another. Microsoft explains profile-based persistence and alias behavior in about_Aliases.

Use a function when the command needs arguments

Aliases do not store parameters or arguments. If you want the shortcut to launch an executable with fixed options, create a function instead:

function editor-project { & 'C:Program FilesExample Editoreditor.exe' '--new-window' 'C:ProjectsDemo' }

Put the function in the same profile if you want it available in later sessions. The call operator & runs the quoted executable path.

Create an alias in Bash

For a simple command substitution in an interactive Bash shell, use:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
alias ll='ls -l'

Type ll at the prompt to run the replacement. Remove it in the current shell with:

unalias ll

Bash expands aliases when it reads interactive input, typically in command position; aliases are not expanded in noninteractive shells by default. An alias also does not provide a way to handle arguments. Use a shell function when the shortcut must accept or arrange arguments. The Bash manual page documents alias expansion and functions.

Rank #4
Sale
PowerShell for Sysadmins: Workflow Automation Made Easy
  • Book - powershell for sysadmins: workflow automation made easy
  • Language: english
  • Binding: paperback

When Windows App Paths is the better fit

If the goal is for Windows Shell application lookup to resolve an executable by name without adding its directory to the global PATH, App Paths registration is a different option. Microsoft documents these registry locations:

  • HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionApp Paths for a per-user registration.
  • HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionApp Paths for a per-machine registration.

Create a subkey named for the executable, such as example.exe, and set its default value to the executable’s full path. An optional Path value is prepended to the environment path for that process. This is Windows Shell application registration, not an alias that becomes available in a PowerShell or Bash session. See Microsoft’s application registration documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Packaged Windows apps: execution aliases

For a packaged Windows desktop app, the app developer can declare an execution alias in the package manifest using the app execution alias extension. This lets users and processes start the packaged app without typing its full path. It is configured as part of the app package, not created by adding a PowerShell profile line or a registry App Paths entry. Microsoft describes the manifest option in its packaging extensions documentation.

Quick troubleshooting

  • PowerShell says the alias is not recognized: confirm the definition ran in the current session, or that you added it to the profile loaded by this PowerShell host.
  • The shortcut needs options or a folder argument: use a function rather than trying to place arguments in an alias.
  • A Bash alias works at the prompt but not in a script: interactive aliases are not expanded in noninteractive shells by default; use a function or invoke the target command directly.
  • You need a Windows app name resolved by the Shell rather than a shell command: investigate App Paths registration; it solves a different lookup problem from a PowerShell alias.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.