0

There are two computers PC1, PC2, there is a fold named: D:\Soft in PC1, and I want to use just one copy of soft.

so I used psubst to create a virtual driver D: in PC2 like below, and it works very well until I restart the PC2, the problem is that if I restart the PC2, the virtual driver D: will disappear.

psubst D: \PC1\D$\soft /P

any help?

2 Answers 2

2

I don't know that command, I always used "net use":

net use d: \\pc1\d$\soft  /persistent:yes

After reboot the drive must still exist, but connection might not be done unless you try open it and enter password manually. This may need to be done every boot.

0
0

A proper use of psubst would require proper UNC path notation:

psubst D: \\PC1\D$\soft /P

The psubst utility (https://github.com/ildar-shaimordanov/psubst) operates like the old DOS subst command to map a network share to a local drive letter. Persistence (to cause the drive to reappear after a reboot) is supposed to be applied with the /P command line option. If it didn't work for you, maybe you were trying to use it on an operating system where that's not supported. Better alternatives for current Windows operating systems today are the "net use" command, and the registry.

For a working demonstration of a mapped drive for modern Windows operating systems using the "net use" command, see How do I map a drive letter to a network share for all RDP users on a Windows Server 2016. The instructions also apply to Windows 10. Basically you'd create a text file drive-d.bat and place it in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp, and then reboot:

net use D: /delete
net use D: \\PC1\D$\soft

You may also want to consider a registry hack instead. To do so, first create a text file called drive-d.reg. You can save it anywhere. Then copy and paste into it the following content:

REGEDIT4 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices] 
"D:"="\\\\PC1\\D$\\soft" 

Once you've saved the file and you're viewing it while sitting inside Windows Explorer, double-click it as if to launch it. Accept the prompts that appear and reboot your machine afterwards.

See also:

You must log in to answer this question.