SID-500

Home » PowerShell » PowerShell: How to quickly switch to your home directory

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.


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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Categories

Who is the blogger?

My name is Patrick Grünauer (pewa2303). I am from Austria. On sid-500 I write about Windows, Cisco and IT-Security in English and German. Have fun while reading!

Patrick Gruenauer
Follow SID-500 on WordPress.com