[batch DOS-CMD command - summary and summary] - how to distinguish the internal command and external command of CMD, and the difference between CMD command and run (win+r) command,

1, How to distinguish the internal command from the external command of cmd?

The distinguishing rule is very simple. The commands that can be printed with the help command in the cmd window are all cmd internal commands, and those that are not included are all external commands.

D:\>help
 For more information about a command, type HELP Command name
ASSOC          Displays or modifies file extension associations.
ATTRIB         Displays or changes file properties.
BREAK          Set or clear extended CTRL+C Check.
BCDEDIT        Set properties in the startup database to control startup loading.
CACLS          Display or modify the access control list of the file(ACL). 
CALL           Call this one from another batch program.
CD             Displays or changes the name of the current directory.
CHCP           Displays or sets the number of active code pages.
CHDIR          Displays or changes the name of the current directory.
CHKDSK         Check the disk and display a status report.
CHKNTFS        Displays or modifies the startup time disk check.
CLS            Clear the screen.
CMD            Open another Windows Command interpreter window.
COLOR          Sets the default console foreground and background colors.
COMP           Compare the contents of two or two sets of files.
COMPACT        Display or change NTFS Compression of files on partitions.
CONVERT        take FAT Volume conversion to NTFS. You cannot convert
               Current drive.
COPY           Copy at least one file to another location.
DATE           Displays or sets the date.
DEL            Delete at least one file.
DIR            Displays the files and subdirectories in a directory.
DISKPART       Displays or configures disk partition properties.
DOSKEY         Edit command line, recall Windows Command and
               Create a macro.
DRIVERQUERY    Displays the current device driver status and properties.
ECHO           Displays messages, or turns command echo on or off.
ENDLOCAL       Ends localization of environment changes in the batch file.
ERASE          Delete one or more files.
EXIT           sign out CMD.EXE program(Command interpreter). 
FC             Compare two files or sets of files and display
               The difference between them.
FIND           Search for a text string in one or more files.
FINDSTR        Search for strings in multiple files.
FOR            Runs a specified command for each file in a set of files.
FORMAT         Format the disk for use with Windows. 
FSUTIL         Displays or configures file system properties.
FTYPE          Displays or modifies files used in file extension associations
               Type.
GOTO           take Windows Command interpreter directed to batch program
               A labeled row in.
GPRESULT       Displays group policy information for the computer or user.
GRAFTABL       send Windows Show extensions in graphic mode
               Character set.
HELP           provide Windows Help information for the command.
ICACLS         Display, modify, back up, or restore files and
               Catalog ACL. 
IF             Perform conditional processing operations in a batch program.
LABEL          Create, change, or delete the volume label of a disk.
MD             Create a directory.
MKDIR          Create a directory.
MKLINK         Create symbolic and hard links
MODE           Configure system equipment.
MORE           Display the output screen by screen.
MOVE           Move one or more files from one directory to another
               catalogue
OPENFILES      Displays files opened by remote users for file sharing.
PATH           Displays or sets the search path for the executable.
PAUSE          Pauses the processing of the batch file and displays a message.
POPD           Restore passed PUSHD Previous to the saved current directory
               Value.
PRINT          Print a text file.
PROMPT         change Windows Command prompt.
PUSHD          Save the current directory and make changes to it.
RD             Delete directory.
RECOVER        Recover readable information from damaged or defective disks.
REM            Record batch file or CONFIG.SYS Notes in(Comments). 
REN            Rename the file.
RENAME         Rename the file.
REPLACE        Replace file.
RMDIR          Delete directory.
ROBOCOPY       Advanced utilities for copying files and directory trees
SET            Display, set, or delete Windows Environment variables.
SETLOCAL       Begin localizing environment changes in the batch file.
SC             Display or configure services(Background process). 
SCHTASKS       Schedule commands and programs to run on a computer.
SHIFT          Adjust the position of replaceable parameters in the batch file.
SHUTDOWN       Allows the computer to be shut down properly, either locally or remotely.
SORT           Sort the input.
START          Start a separate window to run the specified program or command.
SUBST          Associate a path with a drive letter.
SYSTEMINFO     Displays the specific properties and configuration of the computer.
TASKLIST       Displays all currently running tasks, including services.
TASKKILL       Aborts or stops a running process or application.
TIME           Displays or sets the system time.
TITLE          set up CMD.EXE Window title of the session.
TREE           Graphically display the directory of the driver or path
               Structure.
TYPE           Displays the contents of the text file.
VER            display Windows Version of.
VERIFY         tell Windows Is validation performed to ensure that the file
               Write to disk correctly.
VOL            Displays the disk volume label and serial number.
XCOPY          Copy files and directory trees.
WMIC           In interactive commands shell Show in WMI Information.

For more information about tools, see the command line reference in the online help.

The implementation code of internal commands is put in cmd Exe executable program, while the implementation code of external commands is independently placed in other executable programs; For example, the external command where corresponds to where Exe file, and the external command shutdown also corresponds to shutdown Exe file, while the external commands WGet and python correspond to wget exe,python.exe file.

External commands can be expanded, while internal commands are only those (little change), which are absolutely built-in.

Some external commands are built-in to the system. They are available after upgrading or updating the system, such as where and shutdown commands.

Some external commands need to be downloaded and configured, such as python, pip and wget external commands.

2, Difference between CMD command and run (Win+R) command

2.1 cmd internal commands are not easy to execute in the running window

The CMD window can be started by executing the command [CMD] in the run window.

The internal command of Cmd cannot be directly executed in the run window. For example, if [pause] is executed, an error will be reported and the executable file cannot be found.

However, it can be executed indirectly by executing the command [cmd /c pause] in the run window; However, this is actually executed in the cmd window, because the subsequent pause is passed into cmd to execute successfully.

Effect of successful execution.

2.2 all external commands can be executed in "run", but some are best executed in CMD

Some CMD external commands can be executed in either the CMD window or the running window. In fact, the effect is the same. They will be searched according to the order of Path variables.

Example 1:Python command

The effect of executing in cmd is as follows

The effect of executing directly in the run window is as follows:

Example 2: diskpart command

The effect of executing in cmd is as follows

The effect of execution in the run window is as follows

 

Example 3:msconfig command

The effect of executing in cmd is as follows

The effect of executing directly in the run window is as follows

 

However, although some CMD external commands can be executed in the run window, they will not have the corresponding effect; For example, if the where command and shutdown command are not executed in the CMD window, they will immediately flash back.

Therefore, it is recommended that if you do not open the cmd window originally, but simply use a program (and this program does not rely on the cmd window like where and shutdown), you can directly open the program by running the window to execute the command. It is not necessary to open the cmd window first and then execute the command.

2.3 "run" can only search the name without suffix of executable program file

What is an executable program file? When the suffixes are exe, bat, ink (shortcut), etc., they are executable program files.

Some people save the shortcut of the computer application program into a folder, and then the Path of this folder is saved into the Path variable. In this way, you can use Win+R to quickly start the application program.

In contrast, text document files (txt, rtf, md, json, doc, excel, ppt, etc.) and multimedia files (jpg, mp3, mp4, etc.) cannot be started directly by running commands without file suffixes (but can be started by using file names with suffixes).

For example, the Path [D:\Program Files\python\Python38] has been added to the Path variable, including a tool Txt file

I cannot find the file by executing the command [tool] while running.

However, the file can be found by executing the command [tool.txt].  

 

Normally open.

Therefore, the external commands in the CMD window and the commands executed in the run window basically have the same scope of searching files (but the CMD window also searches the current directory), either can be found or can not be found (except the current directory of CMD).  

Tags: Windows cmd dos

Posted by Yegg on Thu, 30 Jun 2022 21:09:34 +0930