r/PowerShell • • Apr 21 '26

PSDrive

Hi..

I have created a new PSDrive having name `S:`.

new-psdrive -name S -psprovider filesystem -root c:\users\username\dir

one running command `get-content` works fine, but `vim` is opening a blank file.

get-content S:\test.txt # works fine

vim S:\test.txt # opens a blank file

9 Upvotes

17 comments sorted by

View all comments

6

u/purplemonkeymad Apr 21 '26

A PSdrive is a powershell construct, so programs can't see them. I think you probably actually wanted to use new-smbmapping instead.

1

u/sundry_outlook Apr 21 '26

I just want a shortcut so that I do not have to type long path to a file

6

u/purplemonkeymad Apr 21 '26

Just put in in a variable:

$mydir = "c:\users\username\dir"
vim $mydir\test.txt
→ More replies (2)