I just started using Windows Powershell and one major problem I've run into is when I start it, it starts me off in this directory:
C:\Users\Username
However, the directory I usually need to navigate to is in something like:
C:\Users\Username\Dropbox\Websites\2014\Projects\ProjectName
And sometimes it goes much deeper. So you can see how it is a little annoying to navigate each time I start the shell to this directory using ten separate cd commands. I was wondering if there was a way to set up a shortcut or alias for something like:
cd C:\Users\Username\Dropbox\Websites\2014\Projects\ProjectName
Or possibly I could set some sort of shortcut to the directory only so I could do something like:
cd shortcut
And it would cd to the proper directory. Does anyone have any experience with something like this? Is this a dumb thing to do? I'm very new to using any command line so I'm just trying to get used to navigating around files and folders more easily.
Typing CD\ causes PowerShell to move to the root directory. As you can see, you can use the CD.. or CD\ command to move to a lower level within the folder hierarchy. You can also use the CD command to enter a folder. Just type CD, followed by the folder name.
Using command-line utilities The Windows PowerShell prompt opens by default at the root of your user folder. Change to the root of C:\ by entering cd c:\ inside the Windows PowerShell prompt.
Open any PowerShell file. Press Alt+Shift+S (or whatever keybinding you have for "Powershell: Show Additional Commands from PowerShell Modules"). Select the custom command from the drop-down list of PowerShell commands.
Use " " Double Quotes to Deal With Spaces in the Path While Changing the Current Directory in PowerShell. The cd command changes the current directory in PowerShell. If the path contains spaces, you will get an error when you don't put the path in double quotes " " .
There is also another way to do this:
function PP { cd C:\Users\Username\Dropbox\Websites\2014\Projects\ProjectName }
Set-Alias shortcut `PP`
new-psdrive is your friend :
New-PSDrive -Name docs -PSProvider FileSystem -Root "C:\Users\username\Documents"
cd docs:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With