Open JoanEliot opened 3 years ago
That's correct because the order of the arguments and options is mandatory. Run the tool with /?
option and to learn more about usage. The correct usage is as follows:
PSUBST [drive1: [drive2:]path] [/P | /PF]
Sorry! I missed your reply before I edited my original post. I figured out I had the argument in the wrong place, and then ran into a new issue as above. But as for the order of arguments point, I get no error message with pubst /P so maybe an update to recognize that also as an out-of-order parameter?
The command psubst /P K: C:\z\K
doesn't throw any issues because it's executed as this one psubst /P
(ignoring everything after /p
).
Regarding the second issue Unable to add persistently SUBSTed drive
. I reviewed the code and didn't find any reasons to throw it with the /pf
option. This could happen with the /p
option only (and without elevated privileges).
Can you remove the entry with the command psubst K: /d /pf
, then repeat the creation command psubst K: C:\z\K /PF
? Let me know more details.
Results (non-elevated or elevated, same):
>psubst K: /d /pf
psubst: Drive not SUBSTed persistently
>k:
K:\>
>psubst K: C:\z\K /PF
psubst: Unable to add persistently SUBSTed drive
But regardless, the 'K drive' is working and giving me no trouble—I don't seem to need whatever /PF offers.
I need to understand or become closer in understanding what's wrong in your situation. Would you be perform the following steps:
reg export "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices" tempfile
type tempfile
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices
; find the K:
value and delete itpsubst /p
psubst K: C:\z\K /PF
psubst /p
againShare results here.
Sorry for not replying earlier. Still pretty busy so can't promise prompt feedback but here you go—
Results (tempfile listing -- note that there is no entry for K )
"AUX"="\\DosDevices\\COM1"
"CON"="\\Device\\ConDrv\\Console"
"CONIN$"="\\Device\\ConDrv\\CurrentIn"
"CONOUT$"="\\Device\\ConDrv\\CurrentOut"
"MAILSLOT"="\\Device\\MailSlot"
"NUL"="\\Device\\Null"
"PIPE"="\\Device\\NamedPipe"
"PRN"="\\DosDevices\\LPT1"
"Silos"="\\Silos"
"UNC"="\\Device\\Mup"
>psubst K: C:\z\K /PF
psubst: Unable to add persistently SUBSTed drive
@JoanEliot, I guess, the user you work with doesn't have writing permissions in the particular subkey. Let's try one more attempt.
sudo.bat
from this link: https://raw.githubusercontent.com/ildar-shaimordanov/cmd.scripts/master/unix-like/sudo.bat. Save it next to psubst.bat
psubst K: C:\z\K /p
psubst /p
ver
Capture the results of all commands you execute in this attempt and share.
Originally I thought there was a problem with /PF because I got an error when using the parameter in the wrong place.
This is incorrect:
psubst /PF K: C:\z\K
(butpsubst /P K: C:\z\K
did not throw an error)Now I have an error when using /PF in the right place:
C:\util>psubst K: C:\z\K /PF
psubst: Unable to add persistently SUBSTed drive
However, pubst /P reports the drive as present, despite the error. Does that mean I have a SUBSTed drive with the features of a /P persistence, but not those expected with /PF?