The C # Process class allows you to run the command line executable on Windows. The Process.StartInfo class contains information about the command line job that you want to run, including its path and file name.
My problem is that Process.Start () will throw an exception if the file does not exist. To avoid an exception, I encoded the check to check if the file exists, but in all cases it does not work properly, as the name may not exist as a file with that exact name, but it may have an executable instance. For example, "C: \ SoAndSo" may not exist as a file, but "C: \ AAndSo * .exe *" does and will be successfully found when you run the Process command.
I hacked my checks to try the name given to me, and the name + ".exe" and ".bat", but this seems awkward, and maybe I am missing other executable extensions.
So: is there a command to ask the question: "Do you have an executable version of the file name starting with" SoAndSo "?
source share