vbscript Eval a string to a Variable in a loop?

前端 未结 3 1809
梦如初夏
梦如初夏 2020-12-22 01:33

I am trying to use vbscript\'s Eval (or maybe I need Execute) to create some variables from the key names from an ini file. The ini file can have unlimited unknown key=val p

3条回答
  •  无人及你
    2020-12-22 01:42

    You eval'd the literal code pair.key = pair.value.
    That assigns to pair.key.

    You want to assign to the value of pair.key – if pair.key is myPath, you want to eval myPath = pair.value.
    You can do that by concatenating strings:

    Execute(pair.name + " = pair.value")
    

提交回复
热议问题