3

Below is my script to share a folder and map it to drive x:

net use x: /delete
net share "Shared Folder" /delete
net share "Shared Folder"="D:\MyFolder\Shared Folder" /GRANT:everyone,full
net use x: "\\My-PC\MySharedFolder" /P:Yes
pause

After I execute this above command from a batch file (Run as Administrator), I do see x: drive from my command line window but windows explorer is not showing x: drive. Then I go to windows explorer manually map x: drive again to shared folder then I see x: drive in windows explorer please help me to solve this issue.

2 Answers 2

2

I remember seeing this error. This is because you are running your batch file using "Run as administrator". If you don't run as administrator you will end up receiving an access denied error.

Since you ran run as administrator, you are not seeing those folders in your windows explorer, which is not run as administrator.

Try these:

  1. After you run your batch file (Run as administrator), Open two command line one run as administrator and the second not as administrator. One that is not run as administrator will also not show your x: drive

  2. Run your batch file run as administrator then again run it, but this time not run as administrator. You will receive an access denied message but ignore that. Now you will see x: drive in windows explorer

0
0

Even if you map a drive with e.g. net use .. as the current user, sometimes it still won't show up in Explorer. I had to exit the Explorer process and start it again to solve the problem.

To exit Explorer correct you should use Ctrl + Shift + right-click Taskbar and then you get this option: enter image description here

You can start it again in Task manager: enter image description here

enter image description here

Maybe there is a better way to "refresh" the mapped drives in Explorer?

You must log in to answer this question.

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