473,473 Members | 1,576 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Create new drive in a System using C#

Hi,

I am using .NET 1.1 along with 2K Professional Operating System.

How to create a new drive in a system which is not available in my
system.

Example: My System is having the A,B,C,D,E these drives..

I need to create another drive like F which is not available.

I have the code for this...

Any body give the smart Idea rather than this One..

This is my code..

string [] ArrPossibleDrives=new
string[]{"A","B","C","D","E","F","G","H","I","J","K","L"," M","N","O","P"
,"Q","R","S","T","U","V","W","X","Y","Z"};

string [] ArrSysDrives=new string[10];
string strArrayElement;
string MapDrive="";
int a;
ArrSysDrives=System.IO.Directory.GetLogicalDrives( );
for(int i=0;i<ArrSysDrives.Length;i++)
{
strArrayElement=ArrSysDrives[i];
strArrayElement=strArrayElement.Substring(0,strArr ayElement.IndexOf(":",
0));
ArrSysDrives[i]=strArrayElement.ToUpper();
}

for (int i=0; i<ArrSysDrives.Length; i++)
{
for (int j = 0; j < ArrPossibleDrives.Length; j++)
{
a = ArrSysDrives[i].CompareTo(ArrPossibleDrives[j]);
if(a==0) // If Exists=0 else returns -1
{
ArrPossibleDrives[j]=null;
}
}
}
for(int i=0;i<ArrPossibleDrives.Length;i++)
{
if(ArrPossibleDrives[i]!=null)
{
MapDrive=ArrPossibleDrives[i];
break;
}
}

Thanks in advance for giving the great inputs

Thanks & regards
*** Sent via Developersdex http://www.developersdex.com ***
Mar 17 '06 #1
3 1682

"Kondapanaidu" <kondapanaidu> wrote in message
news:OQ**************@TK2MSFTNGP09.phx.gbl...
Hi,

I am using .NET 1.1 along with 2K Professional Operating System.

How to create a new drive in a system which is not available in my
system.
What do you mean by creating a new drive? Do you want to create a partition?
Map a drive letter to a volume? Map a network share? Or do you just want to
figure out what the next free drive is(which is sorta what your code sample
looks like it's doing?)

You can't just create drives like directories and there is no support in the
framework to do anything remotely like any of the possiblities(unless you
are just trying to figure out the next free drive), but if you can tell me
what you mean exactly I might be able to find out if it can be done
natively.

Example: My System is having the A,B,C,D,E these drives..

I need to create another drive like F which is not available.

I have the code for this...

Any body give the smart Idea rather than this One..

This is my code..

string [] ArrPossibleDrives=new
string[]{"A","B","C","D","E","F","G","H","I","J","K","L"," M","N","O","P"
,"Q","R","S","T","U","V","W","X","Y","Z"};

string [] ArrSysDrives=new string[10];
string strArrayElement;
string MapDrive="";
int a;
ArrSysDrives=System.IO.Directory.GetLogicalDrives( );
for(int i=0;i<ArrSysDrives.Length;i++)
{
strArrayElement=ArrSysDrives[i];
strArrayElement=strArrayElement.Substring(0,strArr ayElement.IndexOf(":",
0));
ArrSysDrives[i]=strArrayElement.ToUpper();
}

for (int i=0; i<ArrSysDrives.Length; i++)
{
for (int j = 0; j < ArrPossibleDrives.Length; j++)
{
a = ArrSysDrives[i].CompareTo(ArrPossibleDrives[j]);
if(a==0) // If Exists=0 else returns -1
{
ArrPossibleDrives[j]=null;
}
}
}
for(int i=0;i<ArrPossibleDrives.Length;i++)
{
if(ArrPossibleDrives[i]!=null)
{
MapDrive=ArrPossibleDrives[i];
break;
}
}

Thanks in advance for giving the great inputs

Thanks & regards
*** Sent via Developersdex http://www.developersdex.com ***

Mar 17 '06 #2


Hi,

I am mapping drive with another system.i.e(My server) There some files
is there I need to fetch those files into my system.

For that I am mapping with that system.
I need One letter to map. Which is not available in my system.

Example: My system is having A,B,C,D,E

I need 'F' volume to Map that drive..

Thanks & regards
*** Sent via Developersdex http://www.developersdex.com ***
Mar 17 '06 #3
HI,
I am mapping drive with another system.i.e(My server) There some files
is there I need to fetch those files into my system.

For that I am mapping with that system.
I need One letter to map. Which is not available in my system.


You can execute net like : "net use f: \\servername " , you can use the
Process class

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Mar 17 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
6
by: Chad Crowder | last post by:
Getting the following error on my production server whether the file exists or not: "System.IO.IOException: Cannot create a file when that file already exists." Here's the code generating the...
11
by: Andre | last post by:
Hi, I have ASP.NET application running on standalone (not part of the domain) Windows 2003. I use forms authentication for my application. The problem I have is that I need to create and read...
3
by: Madhu | last post by:
All, New to DB2 environment. Can someone share a script that can be used to a create a DB2 UDB database manually. I am trying to create a database on Linux, single partition. Thanks Madhu
8
by: Chad | last post by:
To anyone who is smarter than I am when it comes to WMI: Here is what I am trying to do: 1) Detect a USB pen drive when it is inserted 2) Retrieve the drive letter of the pen drive 3) Check...
0
by: Niyazi | last post by:
Hi, I created application that store the data in SQL SERVER that reside on network. The client also use this application to access the resources provided with application. But is the client want...
34
by: Tom | last post by:
I'd greatly appreciate advice and code snippets on how to create a ram disk within a C/C++ program. I also need to be able to determine the free space. Thanks in advance for any help.
2
by: rick11 | last post by:
I need know when a drive is a USB drive, what USB port is it in? For the system I am doing this on, I do not have to worry about hubs plugged into hubs (into hubs...). It's just the motherboard...
6
by: mohamed azaz | last post by:
hi I want to know how can I create a simple doc file to drive D in Harddisk by using c++ code please answer me Quickly bye bye
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.