Dismissing network drives when unplugged

Networking, connecting to the internet, wi-fi and home entertainment
User avatar
HansV
Administrator
Posts: 78446
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Dismissing network drives when unplugged

Post by HansV »

Oh, OK. The command explorer.exe simply (re)starts the Windows interface.
You could *add* another command to open the Explorer window:

explorer.exe %userprofile%\documents
Best wishes,
Hans

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Dismissing network drives when unplugged

Post by Rudi »

TX
Will try it in due course.

Cheers
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Dismissing network drives when unplugged

Post by Rudi »

Still gotta test John's last theory, but happy to say I now have a fully working script that clear the disconnected drives and reloads the explorer window. I thought I'd cover all bases with the original Net Use * command and the kill explorer.

TX all for your assistance.

@echo OFF
net use * /DELETE /Y
taskkill /f /IM explorer.exe
START explorer.exe
START explorer.exe %userprofile%\documents
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
HansV
Administrator
Posts: 78446
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Dismissing network drives when unplugged

Post by HansV »

Nice!
Best wishes,
Hans

User avatar
John Gray
PlatinumLounger
Posts: 5408
Joined: 24 Jan 2010, 08:33
Location: A cathedral city in England

Re: Dismissing network drives when unplugged

Post by John Gray »

Rudi wrote:Still gotta test John's last theory...
Theory??
See below the third screen grab.

"The previous commands are not persistent, this means that the minute you reboot your PC the shares will disappear from your computer. To get the shares to survive a reboot, you need to add use the persistent switch."
John Gray

"(or one of the team)" - how your appointment letter indicates you won't be seeing the Consultant...

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Dismissing network drives when unplugged

Post by Rudi »

TX John.
I will look into it. (I want to test it while at home)

:cheers:
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Dismissing network drives when unplugged

Post by Rudi »

Hi John,

According to the network technicians, the mappings are not persistent. The other thing is that I don't reboot my PC when I go home; I simply close the lid and it sleeps. The taskkill is fortunately working quite well now. TX for your advice. :cheers:
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
John Gray
PlatinumLounger
Posts: 5408
Joined: 24 Jan 2010, 08:33
Location: A cathedral city in England

Re: Dismissing network drives when unplugged

Post by John Gray »

Ah - if you don't power off your laptop, then all bets are off...!
John Gray

"(or one of the team)" - how your appointment letter indicates you won't be seeing the Consultant...