473,797 Members | 3,166 Online
Bytes | Software Development & Data Engineering Community
+ 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 [] ArrPossibleDriv es=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=ne w string[10];
string strArrayElement ;
string MapDrive="";
int a;
ArrSysDrives=Sy stem.IO.Directo ry.GetLogicalDr ives();
for(int i=0;i<ArrSysDri ves.Length;i++)
{
strArrayElement =ArrSysDrives[i];
strArrayElement =strArrayElemen t.Substring(0,s trArrayElement. IndexOf(":",
0));
ArrSysDrives[i]=strArrayElemen t.ToUpper();
}

for (int i=0; i<ArrSysDrives. Length; i++)
{
for (int j = 0; j < ArrPossibleDriv es.Length; j++)
{
a = ArrSysDrives[i].CompareTo(ArrP ossibleDrives[j]);
if(a==0) // If Exists=0 else returns -1
{
ArrPossibleDriv es[j]=null;
}
}
}
for(int i=0;i<ArrPossib leDrives.Length ;i++)
{
if(ArrPossibleD rives[i]!=null)
{
MapDrive=ArrPos sibleDrives[i];
break;
}
}

Thanks in advance for giving the great inputs

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

"Kondapanai du" <kondapanaidu > wrote in message
news:OQ******** ******@TK2MSFTN GP09.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(un less 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 [] ArrPossibleDriv es=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=ne w string[10];
string strArrayElement ;
string MapDrive="";
int a;
ArrSysDrives=Sy stem.IO.Directo ry.GetLogicalDr ives();
for(int i=0;i<ArrSysDri ves.Length;i++)
{
strArrayElement =ArrSysDrives[i];
strArrayElement =strArrayElemen t.Substring(0,s trArrayElement. IndexOf(":",
0));
ArrSysDrives[i]=strArrayElemen t.ToUpper();
}

for (int i=0; i<ArrSysDrives. Length; i++)
{
for (int j = 0; j < ArrPossibleDriv es.Length; j++)
{
a = ArrSysDrives[i].CompareTo(ArrP ossibleDrives[j]);
if(a==0) // If Exists=0 else returns -1
{
ArrPossibleDriv es[j]=null;
}
}
}
for(int i=0;i<ArrPossib leDrives.Length ;i++)
{
if(ArrPossibleD rives[i]!=null)
{
MapDrive=ArrPos sibleDrives[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
8874
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 want my users to be able to select a report, click on a command button on a form, which will then automatically create the report as a pdf file and save it to the user's machine. I am using Adobe Acrobat (5.0 I think) and have Adobe Distiller as a
6
13732
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 error (seems to be happening when I try creating a directory) If dirmgr.Exists("s:\blah\" & txt_name.Text) Then lblerror.Text = lblerror.Text & "Unable to build physical path. " &
11
3076
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 files on Windows domain network shared drives and also on shared via Samba Unix drives, which is equivalent to writing/reading to the workgroup computer. Please point, if possible, to detailed step by step description of what needs to be done. Thank...
3
3773
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
8496
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 for a specific folder on the pen drive I keep receiving an error message that reads: An unhandled exception of type 'System.ExecutionEngineException'
0
3233
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 to register new customer or companies they will enter the information in Windows Form and the program automaticaly creates the WORD document under specific folder under application path. Once the empty word file created than ask user if they want...
34
29905
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
2358
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 with 3 USB ports in it. I know it just has 3 USB ports because the whole thing sits on a table without any case around it. Can I tell which drive is in which port? And if so, how? BTW: drives may or may not be there at boot, different thumb...
6
1530
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
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9537
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10209
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10023
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7560
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6803
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5459
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2934
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.