PowerShell

PowerShell: How to quickly switch to your home directory

You certainly know the commands cd and Set-Location. It stands for change directory. I hope you also know the commands cd \ and cd .. But what about cd ~ ?

Type cd ~ to switch to your home directory.

cd ~

Unbenannt.JPG

Set-Location ~

Unbenannt.JPG

Instead of ~ , the environmental variable USERPROFILE can be accessed.

cd $env:userprofile

Unbenannt.JPG

Or use $home.

cd $home

Unbenannt.JPG

Well. Next I tried to use it for copying. Ant it works.

Copy-Item -Path C:\temp\dummyfile1.txt -Destination ~\Documents

Unbenannt.JPG

Nice.

Categories: PowerShell

Tagged as: ,

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.