| 1. |
Solve : Equivalent of Unix eval in Windows? |
|
Answer» Hi, Thanx again... Have you typed FOR /? and read the help? Yes I read the FOR help. But I think you didnt get the real requirement. When I did del myset.cmd & FOR /F %i in ('sb-config --env') do echo SET %i >> myset.cmd It was printing 2 lines of "SET set" into the myset.cmd file. But this one: del myset.cmd & FOR /F "tokens=1,2" %i in ('sb-config --env') do echo SET %i %j >> myset.cmd It was printing the command output with a SET prepended to each line. But I dont want to prefix anything to the output of the command. The command "sb-config --env" output following lines: set STREAMBASE_HOME="D:\StreamBase\StreamBase.6.3" set PATH="D:\StreamBase\StreamBase.6.3\bin";%PATH% I just want to execute them. I already know that I can do sb-config --env > sbenv.cmd call sbenv.cmd del sbenv.cmd Is there any better ways of doing this. ie. without creating an temp cmd file. Thanks and Regards, Preeth I dont think it was appreciated that SET appeared in the output Try this FOR /F "tokens=1,2" %i in ('sb-config --env') do Call %i %j I am getting confused myself. What is the result of including sb-config --env in a batch script? or typing it at the prompt? From the original post Quote "sb-config --env" returns the commands to set some environment variables. The result is having multiples lines of SET commands.So you want to execute each line. What about this? Code: [Select]For /f "delims=" %%A in ('sb-config --env') do call %%A For /f "delims=" %%A in ('sb-config --env') do call %%A is working for me. Thanks GPL and Salmon. |
|