I am attempting to automate a process using a batch script. I want to iterate all the files in a specific directory with a specific file extension (.gho) and do something with it.
I know I can get the file names with "dir /B *.gho" but I would like cmd to list each file name with a number and wait for input then pass file the name off to a variable so it can be combined with another variable containing a command to execute.
Example:
- WinXP.gho
- Win7.gho
- Win10.gho
What image would you like to use?
I know I can write something like this in VB.net but this is going to be used in a PE boot disk and from what I understand .net apps don't work in a PE without some work. Can someone point me in the right direction, once I know it can be done and what to look for I probably can figure out the rest myself.
Thanks in advance.
Assuming that
findstr.exeresides in%SystemRoot%\System32of your PE base OS, and the current working directory under which this script is running, holds your target.ghofiles, here's an example template you can use:As this is a template the extension on line 3 is replaceable with any other, as needed. Your own code would be written from line 18, (replacing the three example lines I included just to show you the result, now assigned to
%opt%. Nothing else between those two lines should be modified.