mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
"start" or "start cmd" now opens a new cmd.exe in its own process. this is how MS cmd does it.
svn path=/trunk/; revision=17875
This commit is contained in:
parent
00e96a6cb1
commit
3d2d6eff0b
1 changed files with 13 additions and 7 deletions
|
@ -169,7 +169,6 @@ INT cmd_start (LPTSTR First, LPTSTR Rest)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* get the PATH environment variable and parse it */
|
/* get the PATH environment variable and parse it */
|
||||||
/* search the PATH environment variable for the binary */
|
/* search the PATH environment variable for the binary */
|
||||||
if (!SearchForExecutable (rest, szFullName))
|
if (!SearchForExecutable (rest, szFullName))
|
||||||
|
@ -186,6 +185,7 @@ INT cmd_start (LPTSTR First, LPTSTR Rest)
|
||||||
free(comspec);
|
free(comspec);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* check if this is a .BAT or .CMD file */
|
/* check if this is a .BAT or .CMD file */
|
||||||
if (!_tcsicmp (_tcsrchr (szFullName, _T('.')), _T(".bat")) ||
|
if (!_tcsicmp (_tcsrchr (szFullName, _T('.')), _T(".bat")) ||
|
||||||
|
@ -197,14 +197,11 @@ INT cmd_start (LPTSTR First, LPTSTR Rest)
|
||||||
|
|
||||||
_tcscpy(szFullCmdLine,comspec);
|
_tcscpy(szFullCmdLine,comspec);
|
||||||
|
|
||||||
memcpy(&szFullCmdLine[_tcslen(szFullCmdLine)],_T(" \" /K \""), 6 * sizeof(TCHAR));
|
memcpy(&szFullCmdLine[_tcslen(szFullCmdLine)],_T("\" /K \""), 6 * sizeof(TCHAR));
|
||||||
memcpy(&szFullCmdLine[_tcslen(szFullCmdLine)], szFullName, _tcslen(szFullName) * sizeof(TCHAR));
|
memcpy(&szFullCmdLine[_tcslen(szFullCmdLine)], szFullName, _tcslen(szFullName) * sizeof(TCHAR));
|
||||||
memcpy(&szFullCmdLine[1], &szFullCmdLine[0], _tcslen(szFullCmdLine) * sizeof(TCHAR));
|
memcpy(&szFullCmdLine[1], &szFullCmdLine[0], _tcslen(szFullCmdLine) * sizeof(TCHAR));
|
||||||
szFullCmdLine[0] = _T('\"');
|
szFullCmdLine[0] = _T('\"');
|
||||||
szFullCmdLine[_tcslen(szFullCmdLine)] = _T('\"');
|
szFullCmdLine[_tcslen(szFullCmdLine)] = _T('\"');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
@ -240,8 +237,17 @@ INT cmd_start (LPTSTR First, LPTSTR Rest)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bCreate = CreateProcess (szFullName, szFullCmdLine, NULL, NULL, FALSE,
|
if(!_tcsicmp(szFullName,comspec))
|
||||||
DETACHED_PROCESS, NULL, NULL, &stui, &prci);
|
{
|
||||||
|
bCreate = CreateProcess (szFullName, szFullCmdLine, NULL, NULL, FALSE,
|
||||||
|
CREATE_NEW_CONSOLE, NULL, NULL, &stui, &prci);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bCreate = CreateProcess (szFullName, szFullCmdLine, NULL, NULL, FALSE,
|
||||||
|
DETACHED_PROCESS, NULL, NULL, &stui, &prci);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue