Coucher Posted February 9, 2012 Share Posted February 9, 2012 Ok, here's some background on what I'm trying to do...Trying to have a USB HDD with WinPE 3.0 on it and multiple WIM files on the HDD for various types of machines that I build.What I have currently is the above, and from the startnet.cmd I call a batch file (build_machine.bat) that invokes diskpart to prepare the disk, then corrects the boot sector using bootsect.exe, then applies image.wim to the target disk. What I've been doing is just renaming whatever <machine type>.wim file to image.wim for the ones I was doing the most of at that time.Trying to build some automation into the process where the batch file queries the BIOS info from the registry and get's the machine family name, sets that to a variable (%image%), then invokes imagex pointing to %image%.wim.The problem I'm running into is with the command that I'm using to query the registry and set the returned value as a system variable. If I manually execute the command via the command prompt within WinPE it works perfectly, sets the system variable exactly as it should, however when I take that exact command and add it as a line in my build_machine.bat file, it errors out.Here's the query command: for /f "tokens=3,*" %a in ('reg query HKLM\HARDWARE\DESCRIPTION\System\BIOS /v SystemFamily ^| findstr SystemFamily') do set image=%bWhich works fine run from the command prompt, but when run from within the batch file errors out with "b was unexpected at this time."Any ideas?Thanks in advance. Link to comment Share on other sites More sharing options...
wimb Posted February 9, 2012 Share Posted February 9, 2012 (edited) in a batch file use %%G (on the command line %G)http://ss64.com/nt/for_f.html Edited February 9, 2012 by wimb Link to comment Share on other sites More sharing options...
Coucher Posted February 10, 2012 Author Share Posted February 10, 2012 D'oh! Not sure how I missed something so simple. After changing to double % marks it works perfectly.Thanks!! Link to comment Share on other sites More sharing options...
os2fan2 Posted March 12, 2012 Share Posted March 12, 2012 You could use F Westlake's 'conset', which can read registry values into the current environment, eg conset /k zdir=HKLM\Software\wendy\folders\%1This line looks for whatever %1 is, and returns the value to zdir. eg batch zsource might set zdir=l:\save\cdata\batch\zsource (the folder containing the source for batch files) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now