1

On Linux with BASH or ZSH I can set an option for cdable_vars which allow me to define a shortcut for a folder.

For example:

export servo="/home/bleakcabal/Documents/servo/"

Lets me cd into this folder by doing:

cd servo

Is there something similar with Powershell? If so how do I do it?

2 Answers 2

1

Yes there is. Use the following code to create a system variable for the folder:

  [Environment]::SetEnvironmentVariable("TEMP1","C:\temp1","Machine")

Where TEMP1 is the system variable name. C:\temp1 is the path name.

You call it in Powershell with the $env:<variable_name> variable

enter image description here

0
0

A normal variable will do the job in PowerShell just as well as an environment variable.

PS C:\> $temp1 = '/temp1'
PS C:\> cd $temp1
PS C:\temp1> _

If you do really want to do it without the $ prefix, checkout cd-extras.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .