Board logo

标题: [文本处理] 批处理怎样提取文本指定字符? [打印本页]

作者: smss    时间: 2020-12-4 13:19     标题: 批处理怎样提取文本指定字符?

文本A
  1. # Enable automatic restart after Windows Update installation
  2. Function EnableUpdateRestart {
  3. Write-Output "Enabling Windows Update automatic restart..."
  4. Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MusNotification.exe" -Name "Debugger" -ErrorAction SilentlyContinue
  5. }
  6. # Disable nightly wake-up for Automatic Maintenance and Windows Updates
  7. Function DisableMaintenanceWakeUp {
  8. Write-Output "Disabling nightly wake-up for Automatic Maintenance..."
  9. If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU")) {
  10. New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Force | Out-Null
  11. }
  12. Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUPowerManagement" -Type DWord -Value 0
  13. Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\Maintenance" -Name "WakeUp" -Type DWord -Value 0
  14. }
复制代码
提取Write-Output "之间的字符"
生成文本B
Enabling Windows Update automatic restart...
Disabling nightly wake-up for Automatic Maintenance...


翻译得到文本C 替换掉文本A Write-Output "之间的字符"
正在启用Windows Update自动重启...
禁用夜间唤醒以进行自动维护...

希望WHY老师教下 我比较笨最好备注下 谢谢老师
作者: xczxczxcz    时间: 2020-12-4 17:32

坐沙发,路过。。。




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2