Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I map drive letter to a local path in PowerShell?

Tags:

powershell

In PowerShell, is it possible to map a drive letter to a local path ?

So for example map x:\ to c:\myfolder1\myfolder2\

like image 326
BaltoStar Avatar asked Apr 13 '13 01:04

BaltoStar


2 Answers

You could use subst:

subst x: c:\myfolder1\myfolder2\

or New-PSDrive:

New-PSDrive -Name x -PSProvider FileSystem -Root c:\myfolder1\myfolder2\

like image 141
Kev Avatar answered Oct 01 '22 09:10

Kev


The following statement will also work (and it only uses native powershell cmdlets):

New-PsDrive -Name [DRIVELETTER] -PSProvider filesystem -Root "\\localhost\C$\[PATH]" -Persist
like image 38
Henrique Avatar answered Oct 01 '22 10:10

Henrique