0

I want to store a value of key in a variable. i solved problem like this in linux using

var1=`cat /path/to/file1.txt | grep -i "no3" | cut -d '=' -f2` 

now i want to store a key's value in variable in windows machine.

Machavity
  • 30,841
  • 27
  • 92
  • 100

1 Answers1

0

Same question.Though you need to escape some special characters:

for /f "usebackq tokens=* delims=" %%# in (`cat /path/to/file1.txt ^| grep -i "no3" ^| cut -d '^=' -f2`) do (
  set "var1=%%#"
)
Community
  • 1
  • 1
npocmaka
  • 55,367
  • 18
  • 148
  • 187