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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a bat file to map network drives

Status
Not open for further replies.

GSMike

Programmer
Feb 7, 2001
143
US
I have code that writes a batch file and then shells the file in:
Code:
sub blahblah
dim fso as new filesystemobject, ts as textstream
set ts=fso.createtextfile("c:\temp\myfile.bat")
ts.writeline "net use m: \\myserver\myshare"
ts.close
shell("c:\temp\myfile.bat",vbhide)
fso.deletefile "c:\temp\myfile.bat"
end sub
Everything works fine as long as I EXCLUDE the line where I delete the text file I just created.
Apparently, the executing code isn't waiting for the batch file to finish its job before it proceeds to the next line of code, and it deletes the batch file before it executes??
Is there a way to have the VB code wait (??) for the batch file to finish executing before it proceeds on the its own next line??
Obviously, I could just leave the file I created there, but I guess I'm kind of complusive about cleaning up after myself.
Thanking you in advance, Mike K
 
that looks right on...THANKS!!!...I'll try it and give you a report back! Mike K
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top