Table of Contents

Create PowerShell Functions in Windows

Confirm the profile file exists.

Test-Path $PROFILE

If the result is False, create the profile file (no need if it already exists).

New-Item -Type File -Path $PROFILE -Force

Open the profile file in Notepad.

notepad $PROFILE

Write the function in the profile file.

function cdpj {
    Set-Location "D:\my-project"
}

Refresh the profile file to apply the changes.

. $PROFILE