469,923 Members | 1,547 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,923 developers. It's quick & easy.

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 1554

"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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

By using this site, you agree to our Privacy Policy and Terms of Use.