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
  • 28,730
  • 25
  • 78
  • 91

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
  • 51,748
  • 17
  • 123
  • 166