| 1. |
Solve : Reading data from inst.dat file and passing to batch argument? |
|
Answer» I am trying to figure out how to extract data from an inst.dat file and pass it into an arguement in my BATCH file. The inst.dat file contains a single raw ascii code that the batch would USE to use logic as to if the data equals say CF4C then do this and if it equals B62A do that. The batch is controlling other automated routines and it would be nice to read in this raw ascii, but hex natured data file and pass it to the argument to have the logic process correctly. This inst.dat file is working as an intermediary between batch and other programs. The other program outputs this 4 digit hex to this inst.dat file as raw ascii. Currently user intervention is required and I am looking to fully automate this process by being able to have the batch read in this 4 hex digit code from this file and then perform the required operations based on what the code referenced in the IF statements. Guessing that I need to read in the file and then pass that data to a variable and then call MD %%variable or is there more involved? Something like that. When reading those FOUR characters, the command shell will see text and interpret them LITERALLY as CF4C and B62A. If those are hex representations you can convert them to decimal equivalents by using the set /a command. Code: [Select]echo off set /a var=0xcf4c echo %var% set /a var=0xb62a echo %var% In a batch file, it doesn't seem much important as long as the batch logic matches the interpreted values from the inst.dat file. Good luck. |
|