APS NZ
asked on
Changing a drive letter to some other drive letter programatically
Hi
I am using Win XP, and I know I can change logical drive letters from Computer Management in Control Panel, but I want to be able to do it programmatically. Specifically (if it is possible) I want to rename the A drive to something else, then map another logical drive to A.
We have a legacy DOS based program that demands to use drive A for backup, and it is a real pain feeding 10 disks in each day.
If anyone has another better idea (other than a software upgrade ;-) - I didn't write the program) I would be grateful.
TIA
John
I am using Win XP, and I know I can change logical drive letters from Computer Management in Control Panel, but I want to be able to do it programmatically. Specifically (if it is possible) I want to rename the A drive to something else, then map another logical drive to A.
We have a legacy DOS based program that demands to use drive A for backup, and it is a real pain feeding 10 disks in each day.
If anyone has another better idea (other than a software upgrade ;-) - I didn't write the program) I would be grateful.
TIA
John
Also check this link, I guess XP has a command called mountvol that can do the trick.
http://www.msfn.org/board/index.php?showtopic=10905&hl=
http://www.msfn.org/board/index.php?showtopic=10905&hl=
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Microsoft says that drive A: and B: is reserved for floppy drives
But there is a workaround for this
Quote from Microsoft
However, if your computer does not have a floppy disk drive, you can assign these letters to removable drives.
source of information : http://support.microsoft.com/default.aspx?scid=kb;en-us;307844
So to create your workaround you have to physically remove the floppy disk drive.
then use the command util "diskpart" by microsoft http://support.microsoft.com/kb/300415
this can be executed from a program with ShellExecute...
thats the only solution i know of -_-
But there is a workaround for this
Quote from Microsoft
However, if your computer does not have a floppy disk drive, you can assign these letters to removable drives.
source of information : http://support.microsoft.com/default.aspx?scid=kb;en-us;307844
So to create your workaround you have to physically remove the floppy disk drive.
then use the command util "diskpart" by microsoft http://support.microsoft.com/kb/300415
this can be executed from a program with ShellExecute...
thats the only solution i know of -_-
ASKER
Thanks for the replies rbohac and Mikho.
The accepted answer works perfectly and will save me a lot of frustration!
John
The accepted answer works perfectly and will save me a lot of frustration!
John
Thank you. You might also want to modify that function to include a check to make sure you don't accidently change the C Drive.
like:
if UpperCase(OldDriveLetter) = 'C' then
begin
ShowMessage('Cant change drive C');
exit;
end;
like:
if UpperCase(OldDriveLetter) = 'C' then
begin
ShowMessage('Cant change drive C');
exit;
end;
Open a command prompt and type "subst /?" for usage.
I found an example of this at http://homepages.borland.com/efg2lab/Library/UseNet/1999/0421a.txt