How do you feed variable file name to GhostSrv executed in a batch file?
This issue has been solved. See solution.
I'm executing ghostsrv, via cmd file, with the following parms:
start ghostsrv.exe C:\images\ghost.gho rstwimg -disk1 -G-sure -le -fc:\ghosterr.txt
I'm trying to replace the ghost file image name with a variable image file name, but don't seem to have much luck. The filename is in a text file which is used as input to a variable called parm, for illustration purposes.
set /P parm = <c:\filename.txt
start ghostsrv.exe %parm% rstwimg -disk1 -G-sure -le -fc:\ghosterr.txt I have also tried %parm and %%parm to see if there is any impact.
I never pickup the variable filename, no matter what I try. Is there a way to do this? Substitute a variable for a file name?
Thanks for any and all suggestions.
Filed under: Ghost Solution Suite, Endpoint Management and Virtualization
Well Two ways to handle
Well Two ways to handle this:
1) Don't put the filename in a file and pass that as an argument of the batch file:
command line:
batchfile.cmd:
2) Use the FOR command to grab the filename from a file.
batchfile.cmd:
NOTE: for either of the above to work you must not have any spaces in the filename path.
Hope this helps
That did the trick! Thank
That did the trick! Thank you for your assistance. I used the FOR solution because of the way the batch file was setup. I just had to change the %parm% to %param%. Every other solution I tried, involving variable name, I could not get to work. It would never pick up the file name, it used the session name as the filename.
Thanks again!!
Your welcome
Your welcome.
Oops you are right the correct script should look like:
If you wanted a single line batch file you could do:
The big difference in last one is, if there were more than one line in c:\filename.txt then it would execute the ghostsrv.exe for each line.
Would you like to reply?
Login or Register to post your comment.