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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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