how to assign the result of a batch command to a variable -
if on command line execute:
c:\digitemp.exe -t0 -o%c -q > res1.txt res1.txt contains correctly numerical temperature in celsius (say: 24.23456). if same command executed inside bat file (say: test.bat):
@echo off echo hola pootol! echo. c:\digitemp.exe -t0 -o%c -q > res1.txt rem set pootol = < res1.txt rem set pootol echo prem una tecla per sortir. pause > null res1.txt contains wrong celsius value suspect related argument " -o%c ". can see rem variable assing cause pootol var wrong assigned celsius value before mentioned. doing wrong?
the problem in case % sign, it's evaluated different in cmd-line , in batch files.
in batch files can escape doubling it.
so code looks like
c:\digitemp.exe -t0 -o%%c -q > res1.txt
Comments
Post a Comment