例如变量表存在export.txt
AAAA=1
BBBB=2
CCCC=3- #@&cls&powershell "type '%~0'|out-string|iex"&pause&exit
-
- $a=new-object -com word.application
- $a.visible=1
- $b=$a.documents.open("$(dir export.docx)")
-
- type export.txt|%{
- $c=$_ -split '='
- $a.selection.find.execute($c[0],1,0,0,0,0,1,1,0,$c[1],2)
- }
-
- #$a.quit(-1,1,0)
复制代码 先测试一下看结果没问题再删除最后一行前面的注释#号就能自动保存了 |