本帖最后由 newswan 于 2021-7-14 00:38 编辑
sed 4.8 -e 连接使用,有问题- set _P_="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
- reg query %_p_% /s | sed -r -e "/^HK| DisplayName| DisplayVersion| InstallLocation/!d" >11.txt
- sed -r -e "s/^HK.*/#/" -e "s/^ +//" -e "s/ +REG_SZ */=""/" -e "/\w/s/$/""/" -i 11.txt
- sed -r -e "s/([\])/\1\1/g" -e "/#/{ N ; /\w/!D } " -i 11.txt
复制代码 powershell- $P="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
- (reg query $p /s ) -match "^HKEY|^ {4}DisplayName|^ {4}DisplayVersion|^ {4}InstallLocation" -replace "^HK.*","#" -join "`n" -replace "#(`n#)+","#" -split "`n" -replace "^ +","" -replace " +REG_SZ *",'="' -replace "(?<=[^#])$",'"' ' -replace "(\\)","`$1`$1"
复制代码
|