#
957bb895 |
| 09-Jul-2024 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Implement /F[:ON|:OFF] switch for file/path completion (#7118) CORE-8002
The switch enables or disables file/path completion in a unique CMD instance. The defaulted values for the completion c
[CMD] Implement /F[:ON|:OFF] switch for file/path completion (#7118) CORE-8002
The switch enables or disables file/path completion in a unique CMD instance. The defaulted values for the completion characters are those mentioned in CMD's help (see also MSDN[^1]): File: Ctrl-F (0x06); Directory: Ctrl-D (0x04)
Manual tests show that only /F:OFF explicitly disables completion. Otherwise, using /F(anything else following) always enables completion with the specific values described above.
[^1]: For additional details, see also https://technet.microsoft.com/en-us/library/cc978715.aspx https://technet.microsoft.com/en-us/library/cc940805.aspx
show more ...
|
#
190b3da9 |
| 09-May-2024 |
Carl J. Bialorucki <cbialo2@outlook.com> |
[CMD][BOOTDATA] Minor improvements (#5745)
* Remove a hardcoded copyright string and move into localizable resources.
* Remove the PROMPT environment variable from clean installs of ReactOS. By def
[CMD][BOOTDATA] Minor improvements (#5745)
* Remove a hardcoded copyright string and move into localizable resources.
* Remove the PROMPT environment variable from clean installs of ReactOS. By default, the command prompt uses $P$G (path + '>') as its prompt settings and does not require this environment variable. Clean installs of Windows Server 2003 do not include this environment variable either. I documented this environment variable in our wiki if anyone would like to set it on their own ReactOS installs.
* Remove the new line above the copyright notice when the information line is turned off.
CORE-16193, CORE-17031
show more ...
|
#
8ce4b739 |
| 13-Jul-2023 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Correctly honour the "short" path flag in %~var enhanced variables expansion. (#5433) CORE-14096, CORE-8002
Patch based on an earlier fix attempt by Doug Lyons. It should fix the problem obser
[CMD] Correctly honour the "short" path flag in %~var enhanced variables expansion. (#5433) CORE-14096, CORE-8002
Patch based on an earlier fix attempt by Doug Lyons. It should fix the problem observed by contributor 'whindsaks' in PR #5403.
This bug has always been present since the implementation of this feature in commit a1eb1f6ba (r40024).
The expansion of %~dpX ennhanced variables used to incorrectly show some directories in uppercase. For example:
```batch :: testcmd.cmd echo '%~dp0' echo '%~dps0' echo '%~s0' ```
would show:
``` P:\Documents and Settings\Administrator\Desktop>echo 'P:\Documents and Settings\Administrator\DESKTOP\' 'P:\Documents and Settings\Administrator\DESKTOP\'
P:\Documents and Settings\Administrator\Desktop>echo 'P:\DOCUME~1\ADMINI~1\DESKTOP\' 'P:\DOCUME~1\ADMINI~1\DESKTOP\'
P:\Documents and Settings\Administrator\Desktop>echo 'P:\DOCUME~1\ADMINI~1\DESKTOP\testcmd.cmd' 'P:\DOCUME~1\ADMINI~1\DESKTOP\testcmd.cmd' ```
instead of the correct:
``` P:\Documents and Settings\Administrator\Desktop>echo 'P:\Documents and Settings\Administrator\Desktop\' 'P:\Documents and Settings\Administrator\Desktop\'
P:\Documents and Settings\Administrator\Desktop>echo 'P:\DOCUME~1\ADMINI~1\DESKTOP\' 'P:\DOCUME~1\ADMINI~1\DESKTOP\'
P:\Documents and Settings\Administrator\Desktop>echo 'P:\DOCUME~1\ADMINI~1\DESKTOP\testcmd.cmd' 'P:\DOCUME~1\ADMINI~1\DESKTOP\testcmd.cmd' ```
The reason was a wrong handling of the presence (or absence) of the "short" path format specifier 's' in those enhanced variables. In the examples above, the "Desktop" sub-directory has a short-path name available (because it is in a FAT partition). The short-path name was used some times also even with the 's' specifier absent.
Co-authored-by: Doug Lyons <douglyons@douglyons.com>
show more ...
|
Revision tags: 0.4.14-release |
|
#
5ca83e51 |
| 22-Jun-2021 |
Jérôme Gardou <jerome.gardou@reactos.org> |
[CMD] Improve performance a bit
Do not use custom alloc/free functions by default. Do not free resources at process exit. - You're doing it brick by brick while the OS & CRT do that with a bulldoz
[CMD] Improve performance a bit
Do not use custom alloc/free functions by default. Do not free resources at process exit. - You're doing it brick by brick while the OS & CRT do that with a bulldozer better than you do.
show more ...
|
#
53bd132c |
| 25-May-2021 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Reset the current thread UI language at startup, and when updating the local code page cache. CORE-17601
|
#
35f499e5 |
| 25-May-2021 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CONUTILS][CMD] Add and use a helper ConStdStreamsSetCacheCodePage() macro instead of repeatedly calling ConStreamSetCacheCodePage() on the standard streams.
|
#
f5ba9de2 |
| 27-Sep-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Fix substring-substitute regression from commit cdc8e45b (use signed offsets).
|
#
d029a626 |
| 22-May-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Make the command-line parser more compatible with Windows' CMD one.
All these modifications have been verified with Windows' CMD, either by using written cmd_rostests and the existing cmd_wine
[CMD] Make the command-line parser more compatible with Windows' CMD one.
All these modifications have been verified with Windows' CMD, either by using written cmd_rostests and the existing cmd_winetests, or manually by enabling the flags cmd!fDumpTokens and cmd!fDumpParse (available in the public symbols) and analyzing how the tokens are being parsed, as well as the generated command tree.
See also the following links for more details (but remember that these observations have to be double-checked in Windows' CMD!):
* Parser rules: https://stackoverflow.com/a/4095133/13530036 * Discussion: https://www.dostips.com/forum/viewtopic.php?f=3&t=8355 * Numbers parsing: https://www.dostips.com/forum/viewtopic.php?t=3758 * Label names vs. GOTO and CALL: https://www.dostips.com/forum/viewtopic.php?f=3&t=3803 and: https://www.dostips.com/forum/viewtopic.php?f=3&t=3803&p=55405#p55405
- Fix REM command parsing. A C_COMMAND-like structure should still be built, so that it can show up during batch command echo. However some specific handling needs to be done, so use instead a new C_REM command type. Escape carets are parsed differently than usual: they are explicitly kept in the command line and don't participate in line continuations. Also, the Windows' CMD behaviour is to discards everything before the last line continuation.
- Prefix operator '@' (the "silent" operator) is parsed as a separate command. Thus, the command @@foo@bar is parsed as: '@', '@', 'foo@bar'.
- Improve the checks for numbered redirection. For this purpose, we check whether this is a number, that is in first position in the current parsing buffer or is preceded by a whitespace- like separator, including standard command operators (excepting '@' !) and double-quotes.
- Empty command blocks, i.e. "( )", standing by themselves, or present in IF or FOR commands, are considered invalid. (The closing parenthesis is considered "unexpected".)
- Ignore single closing parenthesis when being outside of command blocks, thus interpreting it as a command, and ignore explicitly everything following on the same line, including line continuations. This very specific situation can happen e.g. while running in batch mode, when jumping to a label present inside a command block. See the code for a thorough explanation.
- Detect whether a parenthesized block is not terminated at the end of a command stream (getting a NUL character instead of a newline), and if so, bail out early instead of entering into an infinite loop.
- Perform a similar check for the parenthesized list in FOR commands.
- Initialize the static 'InsideBlock' value to a known value.
- The '&' operator (multi-commmand) is allowed to have an empty RHS. When such situation occurs, turn the CurrentTokenType to TOK_END so as to avoid a parse error later on.
- The main body of a IF statement, or its 'else' clause, as well as the main body of a FOR statement, must not be empty, otherwise this is considered a syntax error. If so, call ParseError() that sets the 'bParseError' flag, and forcing all batch execution to stop.
show more ...
|
#
5cf0517b |
| 19-Sep-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Code formatting in SubstituteVar().
|
#
cdc8e45b |
| 04-Jun-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Fix delayed expansion of variables. CORE-13682
- Split SubstituteVars() into its main loop and a helper SubstituteVar() that just substitutes only one variable.
- Use this new helper as the
[CMD] Fix delayed expansion of variables. CORE-13682
- Split SubstituteVars() into its main loop and a helper SubstituteVar() that just substitutes only one variable.
- Use this new helper as the basis of the proper implementation of the delayed expansion of variables.
- Fix a bug introduced in commit 495c82cc, when GetBatchVar() fails.
show more ...
|
#
cb2a9c31 |
| 04-Jul-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Some fixes for getting the enhanced '%~XXX' batch/FOR variables. CORE-11857 CORE-13736
It will be followed with a separate fix for the FOR-loop code. Fixes some cmd_winetests.
A NULL pointer
[CMD] Some fixes for getting the enhanced '%~XXX' batch/FOR variables. CORE-11857 CORE-13736
It will be followed with a separate fix for the FOR-loop code. Fixes some cmd_winetests.
A NULL pointer can be returned for a valid existing batch/FOR variable, in which case the enhanced-variable getter should return an empty string. This situation can happen e.g. when forcing a FOR-loop to tokenize a text line with not enough tokens in it.
show more ...
|
#
c58a6016 |
| 04-Jul-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Document the two extra file attributes the enhanced batch/FOR variables %~aX could handle on Windows >= 8.
They are currently specified for documentation purposes (i.e. what Windows 8+ CMD.EXE
[CMD] Document the two extra file attributes the enhanced batch/FOR variables %~aX could handle on Windows >= 8.
They are currently specified for documentation purposes (i.e. what Windows 8+ CMD.EXE can report) but not used yet, since ReactOS does not support them.
show more ...
|
#
c81bf4f8 |
| 03-Sep-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] IF: Add extra validity checks in ExecuteIf().
|
#
90159e1e |
| 12-Jul-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Implement provisional support for the HIGHESTNUMANODENUMBER environment-like variable.
This variable is available only in Win7+, even if the underlying API GetNumaHighestNodeNumber() is availa
[CMD] Implement provisional support for the HIGHESTNUMANODENUMBER environment-like variable.
This variable is available only in Win7+, even if the underlying API GetNumaHighestNodeNumber() is available in Win2003+
show more ...
|
#
04e0fe06 |
| 12-Jul-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] The "special" environment-like variables are available only when extensions are enabled.
The "special" variables are: CD, DATE, TIME, RANDOM, CMDCMDLINE, CMDEXTVERSION, ERRORLEVEL (and on Win7
[CMD] The "special" environment-like variables are available only when extensions are enabled.
The "special" variables are: CD, DATE, TIME, RANDOM, CMDCMDLINE, CMDEXTVERSION, ERRORLEVEL (and on Win7+, HIGHESTNUMANODENUMBER).
show more ...
|
#
fedc68ae |
| 12-Jul-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] IF: Some functionality is available only when extensions are enabled.
This functionality is: case insensitivity comparisons (/I); CMDEXTVERSION and DEFINED unary operators; EQU, NEQ, LSS, LEQ,
[CMD] IF: Some functionality is available only when extensions are enabled.
This functionality is: case insensitivity comparisons (/I); CMDEXTVERSION and DEFINED unary operators; EQU, NEQ, LSS, LEQ, GTR, GEQ generic string comparators.
show more ...
|
#
d78e8029 |
| 29-Jul-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Additional fixes for ERRORLEVEL and last returned exit code from EXIT, CALL commands and CMD. CORE-10495 CORE-13672
- Fix how the ERRORLEVEL and the last returned exit code are set by EXIT a
[CMD] Additional fixes for ERRORLEVEL and last returned exit code from EXIT, CALL commands and CMD. CORE-10495 CORE-13672
- Fix how the ERRORLEVEL and the last returned exit code are set by EXIT and CALL commands, when batch contexts terminate, and when CMD runs in single-command mode (with /C).
Addendum to commit 26ff2c8e, and reverts commit 7bd33ac4. See also commit 8cf11060 (r40474).
More information can be found at: https://ss64.com/nt/exit.html https://stackoverflow.com/a/34987886/13530036 https://stackoverflow.com/a/34937706/13530036
- Move the actual execution of the CMD command-line (in /C or /K single-command mode) from Initialize() to _tmain(), to put it on par with the ProcessInput() interactive mode.
- Make ProcessInput() also return the last command's exit code.
show more ...
|
#
495c82cc |
| 18-May-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Syntax errors during parsing of batch parameters expansion, or FOR and IF commands, are fatal, and batch execution should stop.
- To this purpose use the ParseErrorEx() that correctly sets the
[CMD] Syntax errors during parsing of batch parameters expansion, or FOR and IF commands, are fatal, and batch execution should stop.
- To this purpose use the ParseErrorEx() that correctly sets the bParseError flag, and return the partially-parsed command so that it gets echoed as well for diagnostics purposes (Windows-compatible).
- Any other parameters specified after (or before) the '/?' switch for the FOR and IF commands, are considered fatal syntax errors as well, thus we employ the ParseErrorEx() as well.
show more ...
|
#
6eb1cae3 |
| 18-May-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Fixes for Batch error execution control flow. CORE-13713 CORE-13736
- In case execution of all batch contexts is stopped (by selecting "All" at the Ctrl-C/Ctrl-Break prompt), notify as well
[CMD] Fixes for Batch error execution control flow. CORE-13713 CORE-13736
- In case execution of all batch contexts is stopped (by selecting "All" at the Ctrl-C/Ctrl-Break prompt), notify as well the CheckCtrlBreak() signal handler once there are no more batch contexts (this in effect resets the internal 'bLeaveAll' static flag in CheckCtrlBreak). This is an adaptation of the fix present in FreeCOM 1.5, first described in https://gcfl.net/FreeDOS/command.com/bugs074g.html .
- Introduce a ParseErrorEx() helper that sets the 'bParseError' flag and displays a customized syntax-error message, only for the first syntax error encountered. Implement ParseError() around the *Ex function.
- In batch mode, echo the original pre-parsed batch file line if a parse error has been encountered.
- When running a compound command - including IF, FOR, command blocks -, and that control flow is modified by any CALL/GOTO/EXIT command, detect this while running the compound command so as to stop it and go back to the main batch execution loop, that will then set up the actual new command to run.
- In GOTO, do not process any more parts of a compound command only when we have found a valid label.
show more ...
|
#
ca912d7b |
| 26-Jul-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Further code style and formatting fixes.
|
#
04eef6d2 |
| 26-Jul-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] parser.c, cmd.c/h : Code style and formatting fixes.
- Change C_IFFAILURE, C_IFSUCCESS into C_OR, C_AND respectively.
|
#
240f6737 |
| 18-May-2020 |
Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org> |
[CMD] Add a ExecuteCommandWithEcho() helper and use it in Batch() and as the implementation of RunInstance() FOR-loop helper.
|
Revision tags: 0.4.15-dev, 0.4.14-RC, 0.4.13-release |
|
#
111721a6 |
| 13-Mar-2020 |
Thomas Faber <thomas.faber@reactos.org> |
[CMD] Fix another NtReadVirtualMemory parameter.
Spotted by Hermès.
|
#
72c51aab |
| 13-Mar-2020 |
Thomas Faber <thomas.faber@reactos.org> |
[NTOS:IO][GDI32][CMD] Fix some under-sized variables. CORE-14922
Fixes x64 boot with RTC.
|
#
f6ad0938 |
| 10-Dec-2019 |
Serge Gautherie <32623169+SergeGautherie@users.noreply.github.com> |
[CMD] Fix 'MAX_ULONG' typo in a comment (#2143)
|