I wanted to create a button that unmounts all mounted ISO drives at once, so I asked some AI services for help, and they generated the following Powershell script:
The script works fine, but there is one small issue: after unmounting the ISO drives, empty 'ghost' drive entries remain in the This PC tab.
The ghost entries disappear after I refresh the This PC tab by pressing F5, so it's not a major problem, but it doesn't look very good.
Is there any way to fix this by modifying the script, or by some other method?
For your information, this only happens when 'Use the Opus implementation for the Desktop folder' is enabled under 'Preferences > Folders > Virtual Folders > Desktop'. It does not happen in the Folder Tree.
(1) Open Windows 10 File Explorer and go to This PC.
(2) Open Directory Opus (running as Administrator) and go to This PC as well.
(3) Mount several ISO files. The mounted drives appear in both File Explorer and Directory Opus.
(4) Click my script button to unmount all ISO files.
After that...
In Windows File Explorer, all ISO drives disappear correctly.
In Directory Opus, the ISO drives are unmounted, but empty ghost drive entries (for example, N: and M:) remain in the This PC view.
As I mentioned before, this does not happen in the Directory Opus' Folder Tree.
Sorry, I misunderstood your previous reply(I'm not good at English). I thought you were suggesting that I try running Opus as Administrator, so I tested it that way.
I normally run Directory Opus without Administrator privileges, and the issue originally occurred in that non-admin setup. I have also tested it without Administrator privileges again, and the issue still occurs.
Today, I tested the issue using DOpus's own unmount command instead of the PowerShell command.
It seems that DOpus's EJECT command only ejects a drive specified by the user rather than unmounting multiple ISO drives at once, so I created a longer command by listing all possible drive letters. On my system, ISO-mounted drives use letters from M: to Z:. I also added @enableif:=Exists("C:") at the top so that the button would always remain enabled.
@enableif:=Exists("C:")
@ifexists:M:
Go M:\ EJECT
@ifexists:N:
Go N:\ EJECT
@ifexists:O:
Go O:\ EJECT
@ifexists:P:
Go P:\ EJECT
@ifexists:Q:
Go Q:\ EJECT
@ifexists:R:
Go R:\ EJECT
@ifexists:S:
Go S:\ EJECT
@ifexists:T:
Go T:\ EJECT
@ifexists:U:
Go U:\ EJECT
@ifexists:V:
Go V:\ EJECT
@ifexists:W:
Go W:\ EJECT
@ifexists:X:
Go X:\ EJECT
@ifexists:Y:
Go Y:\ EJECT
@ifexists:Z:
Go Z:\ EJECT
Unfortunately, the result was the same as when using the PowerShell command: ghost drives remained visible in the "This PC" view.
The issue occurred regardless of whether DOpus was running with administrator privileges or without them.
Since the same issue occurs even when using DOpus's own built-in command, I think we can at least confirm that this is not a compatibility issue with the PowerShell command, but rather appears to be an issue within DOpus itself.
P.S. I don't know why several drive letters like M:, O:, V:, and X: were converted into emoji icons.
How? Well... Are you asking how I mount the ISO files?
I generally mount them by double-clicking the ISO files. Sometimes, when multiple ISOs are in the same location, I select them all and choose "Mount" from the right-click menu. The ghost drive issue occurs with both methods.
When I eject the ISO drives one by one using "Eject" from the right-click menu, the issue does not occur. However, when I use either PowerShell or DOpus's built-in EJECT command to unmount them, ghost drives remain in DOpus, just like in the image below.
This does not happen in Windows Explorer. Interestingly, even in DOpus, the issue does not occur if I uncheck 'Use the Opus implementation for the Desktop folder' under Preferences > Folders > Virtual Folders > Desktop.