1

I'm trying to assign a command output to a variable for later use, without the use of temp files. Following answers from here, using for /f "delims=" %%i in ('command') do set output=%%i, the prompt flashes too fast so I can't read the error message.

The command in question is echo ;%PATH%; | find /C /I "%PATH2%" where %PATH2% is an earlier set variable containing the path to the python folder. I'm trying to check if the user has the path set, and depending on that continue on. So I want to assign the command output from that command to a variable, in this case "output".

Community
  • 1
  • 1
Acidvenom
  • 11
  • 1
  • Why can't you use temporary files? – ender_scythe Aug 18 '16 at 22:27
  • 3
    Do not double-click the batch-file, open a command prompt window and run it from there, then you can read its output and error messages... You will need to escape the pipe symbol like `^|` within a command line parsed by `for /F`... – aschipfl Aug 18 '16 at 22:29
  • 1
    You can also add @pause at the end of your batch file, this way it will wait for an input before to close – Tim Aug 19 '16 at 12:04
  • Possible duplicate of [Capture output command CMD](http://stackoverflow.com/questions/14646575/capture-output-command-cmd) – aschipfl Nov 24 '16 at 16:23

0 Answers0