Home > OS >  How to get Windows CMD order to perform the return values
How to get Windows CMD order to perform the return values

Time:09-20

Windows environment, want to get the CMD command after the return value of the

Under such as CMD, implement the dir, stdout output in the current directory list, after the execution of the return value how to obtain, want to know how many, the return value is zero or how to print out

Another, Windows have any command line tools, such as in Linux grep, nstat, such as is not to find similar grep, and Windows in the corresponding nstat such commands, but a Linux application is mostly form of the command line, under the Windows there are no command line programs can be installed now

CodePudding user response:

The most convenient option is redirected to a file
Grep function can use the find, netstat is not clear, if really doesn't understand a command prompt, can consider to learn power shell, the function more powerful, CMD and shell than function is too weak, powershell function is more complete,
If you install the win10, can hold a bash components

CodePudding user response:

reference 1st floor Runnerchin response:
is the most convenient is redirected to a file
Grep function can use the find, netstat is not clear, if really doesn't understand a command prompt, can consider to learn power shell, the function more powerful, CMD and shell than function is too weak, powershell function is more complete,
If you install the win10, can hold a bash component


I will leave stdout and stderr redirect to the contents of a file, use a.e xe 1 & gt; A.t xt, a.e xe 2 & gt; A.t xt

Also please comment how to put the return value is redirected to the file

CodePudding user response:

The return value is what concept? Its return value in the stdout,
Or is similar to the shell in $? Command to run state of success/failure? This is % errorlevel %,

CodePudding user response:

The
reference 3 floor Runnerchin response:
the return value is what concept? Its return value in the stdout,
Or is similar to the shell in $? Command to run state of success/failure? This is errorlevel % %


Is like the return of a C program, followed by the value of normal is 0, corresponding to different values

For CMD command inside don't understand, don't know how the return value

CodePudding user response:

Errorlevel
 % % 

CodePudding user response:

reference 5 floor Runnerchin reply:
 % errorlevel % 


The % errorlevel % how to obtain, can be redirected to a file

CodePudding user response:

Direct reading value of the variable % errorlevel %, echo out redirected to also go,

CodePudding user response:

refer to 7th floor Runnerchin response:
direct reading value of the variable % errorlevel %, echo come out to redirect to also go,


Thank you very much

CodePudding user response:

Direct reading value of the variable % errorlevel %, echo out redirected to also go,
This how to read, how to operate
  • Related