MicrosoftDocs / windowsserverdocs

Public content repository for Windows Server content.
Creative Commons Attribution 4.0 International
1.34k stars 1.78k forks source link

Really? #4305

Open RocketCityElectromagnetics opened 4 years ago

RocketCityElectromagnetics commented 4 years ago

"Enables the command extensions... " For real? How about explaining what command extensions are or even a link (anchor) to what command extensions are. This is beyond absurd. Whoever wrote this must have intended to be aleck.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ghost commented 4 years ago

Please note that this makes sense to most people learning in detail how the operating system works in a command line environment.

Regarding your suggestion to explain what command extensions are; it is a topic unto itself and can have different meanings to different people, depending on their scenario. In some scenarios, it can be interpreted to mean any file you can open by entering the file name (without the extension) to open that file in its current default application. In other scenarios, it can mean any script file you can run like a command within the setlocal / endlocal environment.

I recommend reading more about the topic by doing a web search and see if you can find the information you require to understand the concept:

If your experience still urges you to say that the documentation needs to be improved, please post again with suggestions on how to add proper, factual information and suggestions on where it fits within the already existing information on the page.

Thank you for wanting to improve the documentation. Appreciated.

KalleOlaviNiemitalo commented 4 years ago

Command Extensions is a mode of the cmd command interpreter that changes the behavior of variable expansion and of many internal commands. These changes are described in the documentation of each command. The cmd documentation topic has a list of affected commands, although it fails to mention the date and time commands. The assoc, color, and ftype commands are not available at all if Command Extensions are disabled.

ghost commented 4 years ago

Thank you for pointing out the details which could be added to improve the article. I notice that the commands date and time have got their own pages, but I also appreciate your point that setlocal affects those commands and that the details should be mentioned.

KalleOlaviNiemitalo commented 4 years ago

To be clear, I suggest these changes:

KalleOlaviNiemitalo commented 4 years ago

Command Extensions is a mode of the cmd command interpreter that changes the behavior of variable expansion and of many internal commands.

By "internal commands", I mean commands that run within the cmd process, as opposed to external commands that run as separate processes and have their own .exe files.

ghost commented 4 years ago

Point taken, fair point. I will start a PR to suggest those changes.

ghost commented 4 years ago

There you go. PR #4461 is now available for review, comments, and suggestions. Feel free to join in.

RocketCityElectromagnetics commented 4 years ago

Thank you. Very much appreciated. I am of the generation that has been coding since the 80's, and I never saw the concept of command extensions until around the turn of the new millennnium, and it seems there is confusion among the creators of the concept about just what it means and exactly what are its impact -- what functionality is added, what functionality is removed, and there is terribly inconsistency in the industry on which built-in functions behave differently with commadn extensions -- terrible, terrible, genuinely awful consistency. Thank you for any and all effort to try to better clarify Microsoft's intent for command extensions. Perhaps some day soon we will even see greater consistency in built-ins conforming to the rules set for command extensions by Microsoft. I am, however, thankful that MS hasnt alltogther abandoned classic command line and batch and forced migration to exclusively PowerShell. While PowerSheel certainly brings greater capability, I'd almost rather resort to Tcl than deal with the exact syntax of the myriad of commands in PS though in modern times, I do realize we have IntelliSense/Code-completion and a vast information super highway to misguide us for hours and weeks on end. Before creating artifical intelligence, I'd like to see us preserve what little human intelligence and rebuild more of the human intelligence that has quickly faded in the past century and at an exponential rate as we see in the madness in all contexts and all cultures over the past decade.

ghost commented 4 years ago

Thank you for the nice words. As a former computer support agent and onsite technician, I am mostly driven by troubleshooting and general software, installation and maintenance knowledge. I see what you are saying, but as a hobby linguist and in the light of cynicism, it is far too easy to imagine that the future will be dictated by money, might, or the masses of mainstream people. We can only hope for the better.

KalleOlaviNiemitalo commented 4 years ago

Perhaps some day soon we will even see greater consistency in built-ins conforming to the rules set for command extensions by Microsoft.

I'm not sure what rules you refer to. Anyway, because cmd is in maintenance mode, I don't think Microsoft will make any changes to the syntax of its built-in commands.

Surprisingly, command extensions are currently at version 2:

C:\>IF CMDEXTVERSION 1 (ECHO yes) ELSE (ECHO no)
yes

C:\>IF CMDEXTVERSION 2 (ECHO yes) ELSE (ECHO no)
yes

C:\>IF CMDEXTVERSION 3 (ECHO yes) ELSE (ECHO no)
no

SETLOCAL ENABLEEXTENSIONS and CMD /E:ON don't seem to provide a way to select a different version of command extensions. I wonder when version 2 was added, and how it differs from version 1.

ghost commented 4 years ago

SETLOCAL ENABLEEXTENSIONS and CMD /E:ON don't seem to provide a way to select a different version of command extensions. I wonder when version 2 was added, and how it differs from version 1.

I tried searching the web for clues to an answer to your question. This is one of the hits I found:

https://github.com/imatix/gsl/blob/master/src/c.bat#L21-L30

:-  Start CMD.EXE version detection
verify other 2>nul
setlocal enableextensions
if errorlevel 0 goto __cmd_ok
echo %0: This command requires command extensions version 2 in CMD.EXE.  
echo %0: Please use a supported system (Windows 2000 or newer).
exit
:__cmd_ok
setlocal enabledelayedexpansion
:-  End CMD.EXE version detection

I know this is fairly anecdotal, but maybe it could help a bit with any future research you might want to do for that question.

RocketCityElectromagnetics commented 4 years ago

Very interesting. Thank you.

ghost commented 3 years ago

Sorry for the lack of changes. The page was updated externally, making me lose the overview of what to keep and what to drop from my own changes. I ended up choosing to close the PR and delete the fork I had created, making it necessary to start over from scratch. I plan to make a new PR when I get my next day off.

ghost commented 3 years ago

Note to myself: https://sive.rs/zipit

ghost commented 3 years ago

(ref. #5409 )