| Welcome to Lieben Knowledgebase! |

Hi,
I have a few old MS-DOS programs that store information in flat-file databases on a server. This is done through a drivemapping, because the software does not support networking. However, if I type net use in the prompt, the mappings show: \"not available\". If I double click them in windows explorer, they become available again, until some kind of timeout drops the connection. I want them to be available at all times, because my MS-DOS programs can\'t find the mapping until I actually click the drive.
this can be accomplished by typing net use drivename \\\\path /PERSISTENT:YES
the /persistent switch tells windows to keep the connection alive. In vbscript you could persistently map your drives like this:
Set WshShell = WScript.CreateObject(\"WScript.Shell\")
Set WshNetwork = CreateObject(\"WScript.Network\")
On Error Resume Next
boolPersistent = True
WshShell.Run (\"net use g: /delete /yes\")
WScript.Sleep 2000
WshNetwork.MapNetworkDrive \"g:\", \"\\\\path\", boolPersistent
On Error Goto 0
added by Jos on: 18-06-2008
keywords: login script, vbscript, persistent, drive mapping, Windows XP,