Creating Shortcut Drives

by Aug 5, 2016

All PowerShell Versions

Simply add a new drive to one of the file locations you often visit:

# create folder if it does not exist yet
$path = "$home\Documents\Scripts"
$exists = Test-Path -Path $path
if (!$exists)
  $null = New-Item -ItemType Directory -Path $path

# create new scripts: drive
New-PSDrive -Name scripts -PSProvider FileSystem -Root "$home\Documents\Scripts"

dir scripts:

New-PSDrive creates drives to all the locations you need to access frequently. Note that drives created with New-PSDrive are available in PowerShell only. The new drive is available only in the current PowerShell session. You may want to place this command into your profile script (path to a profile script is found in $profile and may need to be created if it does not yet exist).

Twitter This Tip! ReTweet this Tip!