Answer» Hello all,
I am trying to have this batch STORE a variable read from a file with value INSIDE of it. Here is what I have so far, but it seems it cannot set the variable. This is bewildering. Code: [Select]@echo off cd %userprofile% for /f "delims=" %%a in (code.ini) do ( echo %%a set code= <code.ini ) ECHO Code is: ECHO '%code%' Which results in this: Code: [Select]a1b2C3d4e5 ECHO is off. Code is: ''Perhaps I have the syntax wrong?
Any helpful advice would be greatly appreciatedThis is wrong.
Code: [Select]set code= <code.ini You need help with the set command. Say this: help set And read it over. for READING and parsing ini files, you can use vbscript Code: [Select]Set objFS=CreateObject("Scripting.FileSystemObject") strFile = WScript.Arguments.Item(0) WScript.Echo objFS.OpenTextFile(strFile).ReadLine usage: Code: [Select]c:\test> cscript //nologo readline.vbs myini.ini Set /p var=the above will work for you. QUOTE from: Helpmeh on December 13, 2009, 09:02:04 PM Set /p var=<file.ini the above will work for you.
Once again the only useful help posted! You rock helpmeh.Quote from: PPowerHouseK on December 19, 2009, 10:19:09 AMOnce again the only useful help posted! You rock helpmeh.
Thanks. I remember trying to use the set command to get a variable from a file. It was PRETTY brutal.
|