diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 5420d91e08a..665e13d820e 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -1046,18 +1046,31 @@ void WCMD_setshow_attrib (void) { * Set/Show the current default directory */ -void WCMD_setshow_default (void) { +void WCMD_setshow_default (char *command) { BOOL status; char string[1024]; + char *pos; - if (strlen(param1) == 0) { + WINE_TRACE("Request change to directory '%s'\n", command); + if (strlen(command) == 0) { GetCurrentDirectory (sizeof(string), string); strcat (string, "\n"); WCMD_output (string); } else { - status = SetCurrentDirectory (param1); + /* Remove any double quotes, which may be in the + middle, eg. cd "C:\Program Files"\Microsoft is ok */ + pos = string; + while (*command) { + if (*command != '"') *pos++ = *command; + command++; + } + *pos = 0x00; + + /* Change to that directory */ + WINE_TRACE("Really changing to directory '%s'\n", string); + status = SetCurrentDirectory (string); if (!status) { WCMD_print_error (); return; diff --git a/programs/cmd/wcmd.h b/programs/cmd/wcmd.h index 173a79c498f..af5b2476e7c 100644 --- a/programs/cmd/wcmd.h +++ b/programs/cmd/wcmd.h @@ -63,7 +63,7 @@ void WCMD_run_program (char *command, int called); void WCMD_setlocal (const char *command); void WCMD_setshow_attrib (void); void WCMD_setshow_date (void); -void WCMD_setshow_default (void); +void WCMD_setshow_default (char *command); void WCMD_setshow_env (char *command); void WCMD_setshow_path (char *command); void WCMD_setshow_prompt (void); diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index c8a79436b61..8fc23d6c1f6 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -543,7 +543,7 @@ void WCMD_process_command (char *command) break; case WCMD_CD: case WCMD_CHDIR: - WCMD_setshow_default (); + WCMD_setshow_default (p); break; case WCMD_CLS: WCMD_clear_screen ();