DOS command output interaction

      DOS command output interaction

      Hello.

      I am looking for a way to use the output of a dos command, so that I can use it to test the value for a conditional statement.
      For example, I would like to use the output of a command called "picomod_version.exe" and depending on the result which is either 3 or 7, I would call a specific sub routine.
      The batch file would be like this under a classic windows batch file and it would work. However, with the picoMOD shell, it doesn't work (set /p doesn't work):

      kernelversion.exe > tmpfile
      set /p kernelversion= < tmpfile
      del tmpfile

      IF kernelversion=="3" ECHO picomod3
      IF kernelversion=="7" ECHO picomod7

      Any other way to communicate from a command line program and the script is interesting also.

      Thank you.
      Regards,
      Daniel

      Re: DOS command output interaction

      Yes, "if" works. However what I was looking for is the way to get the output of a command and interact with it.
      The link you provided shows several ways to do it but the "for" command is not supported in the picoMOD dos interpreter.
      The "set /p" is not supported neither, which sould allow directly getting the file content into the variable.

      Also unfortunately, the "echo" command of the picoMOD does not support the "-n" option, which prevents printing a "\n" line feed, and which would allow to construct a temporary file with the "set kernelversion=" string, and then concatenating the second string which is coming from the kernelversion.exe command.
      Nevertheless, I think that I have a solution to work around that problem. I have created a program which writes a dos command before the interesting value to return.
      Hence, this command outputs "set kernelversion=3" directly, with the value which is generated by the command itself also.
      This way, I can just write this command output to a file, and then call the file with "call myfile", which will in turn set properly the kernelvalue so that it can then be used with the "if" command.

      Hence, with this new command, I can now call the file containing the final command, and then use the result like this:
      IF "%kernelversion%"=="3" GOTO picomod3
      IF "%kernelversion%"=="7" GOTO picomod7

      I still think that adding support for the "set /p" command is needed, or even "echo -n", to complete the picoMOD dos interpreter and allow flexibility.
      Currently I don't need them as the fix I made is enough in my situation.

      Thank you.
      Regards,
      Daniel