0

Problem

In the Windows system, type a random cmd into the terminal will return an "undefined" error as following:

C:\Documents>abcd
'abcd' is not recognized as an internal or external command,
operable program or batch file.

What I want is when in this case, a script is run with passing the undefined cmd as an argument. Then in the script, I can define how to handle it.

Why I have this problem

Since I installed WSL, I want to pass all undefined cmd into WSL so that all the Linux cmd can be directly recognized in the batch terminal. Recently my workaround is to define lots of batch scripts that can be recognized by windows-cmd pass it. This, however, looks wordy and less smart.

hengyue li
  • 448
  • 3
  • 17
  • write executable to get output from active window of running cmd.exe. Then start apropriate process (on error message). – Daemon-5 Jul 09 '21 at 10:01
  • In this case, how can I get an interactive window to input the command? Or, you mean in the terminal I run another exe? @Daemon-5 – hengyue li Jul 14 '21 at 08:32
  • You need external application to communicate with command line. [Example 1.Capture stdout](https://stackoverflow.com/questions/285760/). [Example 2.Sending commands to cmd](https://stackoverflow.com/questions/11767654/) – Daemon-5 Jul 15 '21 at 14:02

0 Answers0