Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Mapping a drive
Message
From
26/01/2009 16:11:57
 
 
To
26/01/2009 15:12:55
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01377112
Message ID:
01377134
Views:
17
>>>A routine that must run is coded to look for a mapped drive "Y" and to enforce the mapping
>>>the following code is used
>>>
>>> 'RUN /N net use Y: \\nn.nn.nn.nn\directory_name'
>>>
>>>
>>>
>>>
>>>however this flashed the command window black box for an instant.
>>>
>>>How can we stop the flashing of the black box?
>>>
>>>Thanks in advance
>>
>>
>>if !directory('y:')
>>   wshshell=CREATEOBJECT('wscript.shell')
>>   wshnetwork=CREATEOBJECT('wscript.network')
>>   wshnetwork.MapNetworkDrive('y:','\\myserver\mypath',.f.,'Username','Password')
>>   wshnetwork=.null.
>>   release wshnetwork
>>Endif
>
>What if y: is mapped but to the wrong share?

You can remove any mapping first
<pre>
   wshshell=CREATEOBJECT('wscript.shell')
   wshnetwork=CREATEOBJECT('wscript.network')
   if directory('y:')
     wshnetwork.RemoveNetworkDrive('Y:')
   endif
   wshnetwork.MapNetworkDrive('y:','\\myserver\mypath',.f.,'Username','Password')
   wshnetwork=.null.
   release wshnetwork
Endif
Previous
Reply
Map
View

Click here to load this message in the networking platform