Powershell Best Practice #14: Specify the extension for applications

By | July 5, 2015

Best Practice: It is recommended to append the .exe extension to applications.

Explanation: By adding the extension .exe for applications, you make your code easier to read and you also prevent any confusion.

For example, running sc.exe and sc in PowerShell is different.

sc.exe (it runs C:\Windows\System32\sc.exe)

powershell-sc-exe

sc (is an alias for Set-Content)

set-content-powershell

If your function (or alias) have the same name than an application, the function/alias has priority over the application:

set-content-powershell-prompt


previous-buttonnext-button

Leave a Reply

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