Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using batch file to map, unmap drives...

Status
Not open for further replies.

GSMike

Programmer
Feb 7, 2001
143
0
0
US
I am using:

sub mysub()
dim fso as new filesystemobject, ts as textstream
set ts=fso.createtextfile("c:\temp\temp.bat")
ts.writeline "net use q: /delete"
ts.close
shell("c:\temp\temp.bat",vbhide)
end sub

The question is, how do you write a batch file so that it forces a disconnect, even if files from the share are open? Currently if files are open, I get an MS-DOS dialog box that alerts the user to the open files, and asks them if they would still like to disconnect.

I've tried:

sub mysub()
dim fso as new filesystemobject, ts as textstream
set ts=fso.createtextfile("c:\temp\temp.bat")
ts.writeline "net use q: /delete:yes"
ts.close
shell("c:\temp\temp.bat",vbhide)
end sub
but this doesn't work.

Is there a way to make it so that the disconnect occurs regardless, i.e., so that the batch file, when it would otherwise prompt the user to confirm the disconnect in spite of open files, defaults to "YES"?

Thanking you in advance, Mike K
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top