先来个PS 和 P 的混合体- $str = '[HKEY_LOCAL_MACHINE\SOFTWARE\Le]';
- if ($env:ProgramW6432){$str='[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Le]'};
- ni "$env:temp\xxx.reg" -type file -force;
- gc "$pwd\reg.txt" | ?{ if ($_ -match '^\[HEKY.+Le\]$' ) {
- $STR|ac "$env:temp\xxx.reg" } else { $_|ac "$env:temp\xxx.reg" }
- };
- Start-Process "$pshome\powershell.exe" -argumentlist "-NoProfile -command `
- cmd /c regedit /s '$env:temp\xxx.reg' `
- del '$env:temp\xxx.reg' -Force" -verb runas;
- pause;
复制代码 纯 PS- $str = 'SOFTWARE\Le';
- if ($env:ProgramW6432){$str = 'SOFTWARE\Wow6432Node\Le'};
- Start-Process "$pshome\powershell.exe" -argumentlist "-NoProfile -command `
- md hklm:$str; cd hklm:$str `
- New-ItemProperty . -name 'x' -Value 'ss' `
- New-ItemProperty . -name 'li' -Value 'RF' `
- New-ItemProperty . -name 'jur' -Value '6WHrtyr' `
- New-ItemProperty . -name 'llxj' -Value 'pW'" -Verb runas;
- pause;
复制代码
|