📄 start.c
字号:
/* * START.C - start internal command. * * * History: * * 24-Jul-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>) * Started. */#include "config.h"#ifdef INCLUDE_CMD_START#include "cmd.h"INT cmd_start (LPTSTR first, LPTSTR rest){ TCHAR szFullName[MAX_PATH]; TCHAR *szToken; BOOL bWait = FALSE; if (_tcsncmp (rest, _T("/?"), 2) == 0) { ConOutPuts (_T("Starts a command.\n\n") _T("START command \n\n") _T(" command Specifies the command to run.\n\n") _T("At the moment all commands are started asynchronously.\n")); return 0; } szToken = _tcstok(rest,_T(" ")); /* get the PATH environment variable and parse it */ /* search the PATH environment variable for the binary */ if (!SearchForExecutable (szToken, szFullName)) { error_bad_command (); return 1; } szToken = _tcstok(NULL,_T(" ")); /* check if this is a .BAT or .CMD file */ if (!_tcsicmp (_tcsrchr (szFullName, _T('.')), _T(".bat")) || !_tcsicmp (_tcsrchr (szFullName, _T('.')), _T(".cmd"))) {#ifdef _DEBUG DebugPrintf (_T("[BATCH: %s %s]\n"), szFullName, rest);#endif ConErrPuts (_T("No batch support at the moment!")); } else { /* exec the program */ TCHAR szFullCmdLine [CMDLINE_LENGTH]; PROCESS_INFORMATION prci;#ifdef _DEBUG DebugPrintf (_T("[EXEC: %s %s]\n"), szFullName, rest);#endif /* build command line for CreateProcess() */ _tcscpy (szFullCmdLine, szFullName); if(szToken) { _tcscat (szFullCmdLine, _T(" ")); _tcscat (szFullCmdLine, szToken); } if (CreateProcess (szFullCmdLine, NULL, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, NULL, &prci)) { if (bWait) { DWORD dwExitCode; WaitForSingleObject (prci.hProcess, INFINITE); GetExitCodeProcess (prci.hProcess, &dwExitCode); nErrorLevel = (INT)dwExitCode; CloseHandle (prci.hThread); CloseHandle (prci.hProcess); } } else { ErrorMessage (GetLastError (), _T("Error executing CreateProcess()!!\n")); } } return 0;}#endif/* EOF */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -