From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I map networok drive using CVI?

I have been getting great information from this forum. Thanks to everybody.
Here is my question:
I need to map network drive. For that first I need to know which letter is available:
Secondly, how do I map directly from CVI?
Any comments?
Thanks again.
Sheetal
Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
0 Kudos
Message 1 of 5
(2,913 Views)
Hello

You can run the following command at the command prompt

net use * \\(network drive name)

Using the * will make your system automatically allocate the next available drive letter

Bilal Durrani
NI
Bilal Durrani
NI
Message 2 of 5
(2,913 Views)
If you have Windows SDK installed, you can also use Windows Networking (WNet) functions like WNetConnectionDialog().

Here's a simple example.
Message 3 of 5
(2,913 Views)
Using Bilal's method, you can also see which drive was assigned. If you use DOS redirection of I/O, you can save messages that net use generated and read the new drive from those.

This command displays status messages on the screen.
net use * \\myserver\mynetdirectory

This command saves status messages (if successful) to the local text file mapstatus.txt.
net use * \\myserver\mynetdirectory > mapstatus.txt

Here's a sample of a net use status report.

Drive G: is now connected to \\myserver\mynetdirectory.

The command completed successfully.

You can read these messages from the file, parse the new drive designator and verify that that it was successful.
Note: when using DOS redirection of I/O with net use, if there was an error, the status w
ill be reported to the screen and will not be redirected to the file. The file will be created but it will be empty. If you're trying to read the status from the file but find that it's empty, you'll know you had an error.
0 Kudos
Message 4 of 5
(2,913 Views)
thank a lot for explanation.
Sheetal
Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
0 Kudos
Message 5 of 5
(2,913 Views)