[Batch Help] Findstr + Set

Score
0
Vote Up
March 21, 2008 at 04:39:08 Pacific
Specs: win, intel

say I have a file named config.ini

content of config.ini is

video=nvidia
os=microsoft

=========

OK, now how do I

SET vga=$(video)
SET os=$(os)

by reading config.ini

... Basically I wanna write a batch file that obtains variables from another file


Reply ↓  Report •


#1
Vote Down
Score
3
Vote Up
March 21, 2008 at 05:30:04 Pacific

This should do it:

@echo off
for /f "tokens=1,2 delims==" %%a in (config.ini) do (
if %%a==video set vga=%%b
if %%a==os set os=%%b
)


Reply ↓  Report •

#2
Vote Down
Score
0
Vote Up
March 21, 2008 at 10:38:49 Pacific

Awesome, Thanks.

Reply ↓  Report •

Reply to Message Icon Start New Discussion
Related Posts

« batch merge/substitute to... Best programming language... »

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.

Ask the Community!
Describe your Problem
Example: Hard Drive Not Detected on My PC