![Powershell을 사용하여 .reg 파일로 키 내보내기](https://rvso.com/image/1567498/Powershell%EC%9D%84%20%EC%82%AC%EC%9A%A9%ED%95%98%EC%97%AC%20.reg%20%ED%8C%8C%EC%9D%BC%EB%A1%9C%20%ED%82%A4%20%EB%82%B4%EB%B3%B4%EB%82%B4%EA%B8%B0.png)
VLC를 실행하는 명령에 매개변수를 추가하려면 Windows 7 레지스트리에서 여러 주요 값을 변경해야 합니다.
다행히 모든 키는 다음으로 시작하는 키의 하위 항목입니다 VLC.
.
Open
및 에 대한 명령을 PlayWithVLC
편집해야 합니다. 나는 다음에 대해 생각하고 있습니다 :
- .reg 파일로 키 내보내기,
--no-playlist-enqueue
라인에 추가하기 위해 외부에서 값 편집- 레지스트리에서 .reg 파일을 다시 가져옵니다.
PowerShell에 대한 내 기술은 제한되어 있으므로 코드는 다음과 같아야 한다고 가정합니다.
Get-ChildItem "Registry::HKCR" -Recurse -Force
| where { $_.Name -match 'vlc.'}`
| ForEach-Object {
try {
<create .reg entry>
}
catch { }
}
하지만 나는 이 시점에서 막혔습니다. 앞으로 어떻게 진행해야 할지 조언을 좀 주실 수 있나요?
답변1
좋습니다. PS 기술이 제한되어 있고 레지스트리 조작을 자동화하고 싶습니다.
아아아아... 확실해요? 8-}
말한 모든 것.
여기에 표시된 내용은 설정할 값이나 레지스트리 키를 설정하는 명령을 표시하지 않는다는 점을 제외하면 괜찮습니다.
이러한 cmdlet은 레지스트리를 처리하는 데 사용할 수 있는 cmdlet입니다.
Get-Command -CommandType Cmdlet -Name '*item*'
CommandType Name ModuleName
----------- ---- ----------
Cmdlet Clear-Item Microsoft.PowerShell.Management
Cmdlet Clear-ItemProperty Microsoft.PowerShell.Management
Cmdlet Copy-Item Microsoft.PowerShell.Management
Cmdlet Copy-ItemProperty Microsoft.PowerShell.Management
Cmdlet Get-ChildItem Microsoft.PowerShell.Management
Cmdlet Get-Item Microsoft.PowerShell.Management
Cmdlet Get-ItemProperty Microsoft.PowerShell.Management
Cmdlet Move-Item Microsoft.PowerShell.Management
Cmdlet Move-ItemProperty Microsoft.PowerShell.Management
Cmdlet New-Item Microsoft.PowerShell.Management
Cmdlet Remove-Item Microsoft.PowerShell.Management
Cmdlet Remove-ItemProperty Microsoft.PowerShell.Management
Cmdlet Set-Item Microsoft.PowerShell.Management
Cmdlet Set-ItemProperty Microsoft.PowerShell.Management
마찬가지로 사용하기 전에 도움말 파일과 해당 예제를 살펴보시기 바랍니다.
PSRemote레지스트리 1.0.0.0
이 모듈에는 로컬 또는 원격 컴퓨터에서 레지스트리 하위 키 및 값을 생성, 수정 또는 삭제하는 기능이 포함되어 있습니다.
https://www.powershellgallery.com/packages/PSRemoteRegistry/1.0.0.0
https://stackoverflow.com/questions/28076128/powershell-export-multiple-keys-to-one-reg-file
우리가 알고 있듯이, 주의하지 않으면 레지스트리를 조작하는 것이 정말 해로울 수 있습니다. 따라서 재해가 발생하는 경우 복원할 수 있도록 먼저 백업하거나 최소한 시스템 복원 지점인 VM 체크포인트/스냅샷으로 백업하세요.
따라서 게시된 코드를 약간 수정했습니다. 그러나 취해야 할 작업과 방법을 결정해야 하므로 이를 최종적인 것으로 간주하지 마십시오.
Get-ChildItem "Registry::HKCR" -Recurse -Force `
| where { $_.Name -match 'vlc.'}`
| ForEach-Object {
try {
'Target key to modify / export / whatever'
$_.Name
# 'Registry code here' -WhatIf # remove the whatif if you are sure you are good with what you have
}
catch {
Write-Warning -Message 'Key not accessible'
$_.Name
}
}