[NETSH] Print the commands help text if a command returns ERROR_SHOW_USAGE

This commit is contained in:
Eric Kohl
2025-10-11 15:22:53 +02:00
parent ad6cb32fa5
commit 3cdc3d1652
2 changed files with 5 additions and 2 deletions

View File

@@ -339,7 +339,7 @@ ExecCommand(
DPRINT("ExecCommand()\n");
if (dwArgCount - dwCurrentIndex != 1)
return ERROR_INVALID_SYNTAX;
return ERROR_SHOW_USAGE;
return RunScript(argv[dwCurrentIndex]);
}

View File

@@ -208,7 +208,10 @@ InterpretCommand(
dwError = pCommand->pfnCmdHandler(NULL, argv, dwArgIndex, dwArgCount, 0, NULL, bDone);
if (dwError != ERROR_SUCCESS)
{
ConPrintf(StdOut, L"Commnand: %S Error: %lu\n\n", pCommand->pwszCmdToken, dwError);
if (dwError == ERROR_SHOW_USAGE)
PrintCommandHelp(pTempContext, pCommand);
else
ConPrintf(StdOut, L"Commnand: %S Error: %lu\n\n", pCommand->pwszCmdToken, dwError);
}
}