in reply to Opening not-existing command - Error Handling

It depends what you mean by 'command'. If you mean a shell built-in, then you will have to invoke the shell to find it.

If you mean an external program, then there are a number of ways of finding if it exists. I assume you are on Windows, since you are using the dir command. On Windows, searching the %PATH% environment variable is not enough, Windows searches in several places before it looks at %PATH%. See Win32::SearchPath.

You might find it simpler just to try and call it then handle the exception if it occurs.
  • Comment on Re: Opening not-existing command - Error Handling