Under XP, I want a batch file to automatically determine whether a command entered is built into the system. How should this be handled?
My first thought was to judge it by the output of "%input% /?". The specific idea is: output the contents of %input% /? to a text file, then use the find command to check whether that text file contains the string "is not recognized as an internal or external command". If it does, then %input% is not a command built into the system. But this has a drawback: it creates a temporary file. That is what I am very dissatisfied with. Of course, doing it this way also adds code to delete the temporary file, so it does not look concise enough.
From the above solution, I then thought of another question. If this question can be solved well, then all the problems will be easily resolved. That is: when using a pipe symbol, how can the output of some command be used as the object for the find command to search for a specific string? dir /? |find "is not recognized as an internal or external command" This statement does not work.
My first thought was to judge it by the output of "%input% /?". The specific idea is: output the contents of %input% /? to a text file, then use the find command to check whether that text file contains the string "is not recognized as an internal or external command". If it does, then %input% is not a command built into the system. But this has a drawback: it creates a temporary file. That is what I am very dissatisfied with. Of course, doing it this way also adds code to delete the temporary file, so it does not look concise enough.
From the above solution, I then thought of another question. If this question can be solved well, then all the problems will be easily resolved. That is: when using a pipe symbol, how can the output of some command be used as the object for the find command to search for a specific string? dir /? |find "is not recognized as an internal or external command" This statement does not work.

