diff --git a/src/shell/shell.cpp b/src/shell/shell.cpp index 8f379b2f..8ca34996 100644 --- a/src/shell/shell.cpp +++ b/src/shell/shell.cpp @@ -487,7 +487,7 @@ void SHELL_Init() { MSG_Add("SHELL_CMD_PAUSE_HELP","Waits for 1 keystroke to continue.\n"); MSG_Add("SHELL_CMD_COPY_FAILURE","Copy failure : %s.\n"); MSG_Add("SHELL_CMD_COPY_SUCCESS"," %d File(s) copied.\n"); - MSG_Add("SHELL_CMD_SUBST_NO_REMOVE","Removing drive not supported. Doing nothing.\n"); + MSG_Add("SHELL_CMD_SUBST_NO_REMOVE","Unable to remove, drive not in use.\n"); MSG_Add("SHELL_CMD_SUBST_FAILURE","SUBST failed. You either made an error in your commandline or the target drive is already used.\nIt's only possible to use SUBST on Local drives"); MSG_Add("SHELL_STARTUP_BEGIN", diff --git a/src/shell/shell_cmds.cpp b/src/shell/shell_cmds.cpp index 49ff8277..8a0a9c08 100644 --- a/src/shell/shell_cmds.cpp +++ b/src/shell/shell_cmds.cpp @@ -945,17 +945,22 @@ void DOS_Shell::CMD_SUBST (char * args) { CommandLine command(0,args); if (command.GetCount() != 2) throw 0 ; - command.FindCommand(2,arg); - if((arg=="/D" ) || (arg=="/d")) throw 1; //No removal (one day) command.FindCommand(1,arg); if( (arg.size()>1) && arg[1] !=':') throw(0); temp_str[0]=(char)toupper(args[0]); + command.FindCommand(2,arg); + if((arg=="/D") || (arg=="/d")) { + if(!Drives[temp_str[0]-'A'] ) throw 1; //targetdrive not in use + strcat(mountstring,"-u "); + strcat(mountstring,temp_str); + this->ParseLine(mountstring); + return; + } if(Drives[temp_str[0]-'A'] ) throw 0; //targetdrive in use strcat(mountstring,temp_str); strcat(mountstring," "); - command.FindCommand(2,arg); Bit8u drive;char fulldir[DOS_PATHLENGTH]; if (!DOS_MakeName(const_cast(arg.c_str()),fulldir,&drive)) throw 0;