1

I created a .ps1 script to mount a folder to the Drive S. This works fine. When I reassign an other folder it still works but the name in the explorer wont be updated. But the correct folder is assign. (checked this by the available files after reassign).

I did this with the following script and just changed the path when i reassign an other folder:

subst s: /D
subst s: X:\folder1

So when I run the script for the first time to assign TestFolder1 in the explorer this will be shown:

Screenshot Explorer

And when I run then the script again but to assign TestFolder2 the TestFolder2 will be assign to S: but the explorer will still show TestFolder1 (just like in the screenshot)

Is there a way to update the name in explorer within the script? Or is this a settings issue?

1
  • What if you use PowerShell cmdlets for the task New-PSDrive/Remove-PSDrive/Get-PSDrive. Do they behave the same?
    – SimonS
    Commented Jul 6, 2021 at 12:05

1 Answer 1

0

You are not refreshing anything, you are in effect removing the s: disk with the command subst s: /D. Any Explorer instance that was showing the s: disk will terminate immediately.

Your second subst command creates a new disk, and Explorer knows immediately about it. But this is a new disk that has now to be explored anew.

6
  • Yes i know. I do remove it to assign an other folder to s. And it works but the Explorer still Shows the Name of the old folder, but the new is correctly assignd
    – Loois95
    Commented Jul 6, 2021 at 8:03
  • The only name I can see is computer-name (S:). Perhaps you should add some screenshots to your post for explanation.
    – harrymc
    Commented Jul 6, 2021 at 8:07
  • i tried to explain it with a screenshot in the question now.
    – Loois95
    Commented Jul 6, 2021 at 8:17
  • I can't duplicate that. Which Windows version and how do you get Explorer to display this (I'm trying with View > Tiles)?
    – harrymc
    Commented Jul 6, 2021 at 8:21
  • Windows 10 Version: 10.0.18363 Build 18363. Just Explorer --> This PC
    – Loois95
    Commented Jul 6, 2021 at 8:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .