本帖最后由 wanghan519 于 2024-1-9 03:14 编辑
回复 3# qd2024
从@idwma老师处抄来的第一句,如果需要在bat里执行powershell,加上这句
bat要保存为ascii编码
bat要放到doc目录里- #@&cls&powershell "type '%~0'|out-string|iex"&pause&exit
- $wd = New-Object -ComObject word.application
- gci -Recurse *.doc* | %{$d = $wd.Documents.Open($_.FullName);
- $n = $_.BaseName+"【共"+[string]$d.ComputeStatistics(2)+"页】"+$_.Extension;
- $d.Close();
- ren $_ $n}
- $wd.Quit()
复制代码
|