Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Process class and DOS command
Message
De
24/02/2014 18:43:23
 
 
À
24/02/2014 17:56:08
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01595074
Message ID:
01595083
Vues:
43
This message has been marked as a message which has helped to the initial question of the thread.
>>No, but there are at least a couple of workarounds:
>>
>>1. You can always delete the mapping first, that causes no harm if it doesn't exist i.e.
>>
>>cmd /c net use y: /del
>
>This is good. But, if I want to do it in one command, I might as well do this:
>
>c:\Windows\System32\cmd.exe /c net use y: \\1.1.1.1\d$ /y
>
>...where the last switch will simply send a Y to overwrite the already mapped drive.
>
>>2. In .Net you could check to see if the drive mapping exists e.g. use the DriveInfo class, if it doesn't throw an error trying to get info for Y: then it already exists
>
>That is also another interesting approach. However, the /y switch seems to be the simplest approach to resolve that issue so far.

Now I'm wondering if you even need CMD.EXE, since you're just executing Net.exe with parameters e.g.

%SystemRoot%\System32\net.exe use y: \\1.1.1.1\d$ /y
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform