Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding desktop path to powershell to switch between folders easily?

I'm running a bunch of python scripts that are located in a couple of folders on my desktop. I hate having to type

'cd "C:/Path/to/desktop/folder"'

to go from one folder to another that contains scripts. I want to be able to switch folders easily like

'cd ..'
'folder 1'

so i can switch back to the desktop directory and the type in just the folders name. Is this possible with powershell? Do I just need to add the desktop path to the path environment, if so how do I do this in powershell

like image 690
shreddish Avatar asked Jun 20 '13 14:06

shreddish


2 Answers

cd ~/Desktop or cd ~\Desktop

is what you need.

like image 157
georgeok Avatar answered Oct 05 '22 22:10

georgeok


First : You've got the PowerShell pending to the subst.exe cmd.exe command line interpreter.

New-PSDrive -Name py -Root "cd C:/Path/to/desktop/folder" -PSProvider filesystem

then

cd py:

Second : as in linux you can use the location based CmdLets

push-location "C:/Path/to/desktop/folder"
get-location -stack
pop-location
like image 42
JPBlanc Avatar answered Oct 05 '22 23:10

JPBlanc