Используя Powershell 5.1, я пытаюсь создать значение реестра в:
HKLM:\SOFTWARE\Classes\.
(Примечание завершающего периода)
К сожалению Set-ItemProperty , похоже, игнорирует трейлинг. и создает значение в:
HKLM:\SOFTWARE\Classes
вместо этого.
Я использую Powershell ISE в качестве администратора и протестировал всевозможные кавычки, Path & LiteralPath, обратный тик и трейлинг / безрезультатно.
Я попробовал следующее под другим ключом на случай, если с Классами будет что-то странное ...
$PSVersionTable.PSVersion
New-Item -Path 'HKLM:\SOFTWARE\aTest\.' -ItemType RegistryKey -Force -ErrorAction SilentlyContinue > $null
New-Item -Path 'HKLM:\SOFTWARE\aTest\`.' -ItemType RegistryKey -Force -ErrorAction SilentlyContinue > $null
Set-ItemProperty -LiteralPath HKLM:\SOFTWARE\aTest\. -Name 'Test01' -Value 'emptyFile' -Verbose;
Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\aTest\.' -Name 'Test02' -Value 'emptyFile' -Verbose;
Set-ItemProperty -LiteralPath "HKLM:\SOFTWARE\aTest\." -Name 'Test03' -Value 'emptyFile' -Verbose;
Set-ItemProperty -Path HKLM:\SOFTWARE\aTest\. -Name 'Test04' -Value 'emptyFile' -Verbose;
Set-ItemProperty -Path 'HKLM:\SOFTWARE\aTest\.' -Name 'Test05' -Value 'emptyFile' -Verbose;
Set-ItemProperty -Path "HKLM:\SOFTWARE\aTest\." -Name 'Test06' -Value 'emptyFile' -Verbose;
Set-ItemProperty -LiteralPath HKLM:\SOFTWARE\aTest\`. -Name 'Test07' -Value 'emptyFile' -Verbose;
Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\aTest\`.' -Name 'Test08' -Value 'emptyFile' -Verbose;
Set-ItemProperty -LiteralPath "HKLM:\SOFTWARE\aTest\`." -Name 'Test09' -Value 'emptyFile' -Verbose;
Set-ItemProperty -Path HKLM:\SOFTWARE\aTest\`. -Name 'Test10' -Value 'emptyFile' -Verbose;
Set-ItemProperty -Path 'HKLM:\SOFTWARE\aTest\`.' -Name 'Test11' -Value 'emptyFile' -Verbose;
Set-ItemProperty -Path "HKLM:\SOFTWARE\aTest\`." -Name 'Test12' -Value 'emptyFile' -Verbose;
Set-ItemProperty -LiteralPath HKLM:\SOFTWARE\aTest\.\ -Name 'Test13' -Value 'emptyFile' -Verbose;
Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\aTest\.\' -Name 'Test14' -Value 'emptyFile' -Verbose;
Set-ItemProperty -LiteralPath "HKLM:\SOFTWARE\aTest\.\" -Name 'Test15' -Value 'emptyFile' -Verbose;
Set-ItemProperty -Path HKLM:\SOFTWARE\aTest\.\ -Name 'Test16' -Value 'emptyFile' -Verbose;
Set-ItemProperty -Path 'HKLM:\SOFTWARE\aTest\.\' -Name 'Test17' -Value 'emptyFile' -Verbose;
Set-ItemProperty -Path "HKLM:\SOFTWARE\aTest\.\" -Name 'Test18' -Value 'emptyFile' -Verbose;
но вывод показывает, что он игнорирует. если буквально не сбежал (когда он создает ключ с обратной галочкой в нем ...
Major Minor Build Revision
----- ----- ----- --------
5 1 17134 228
VERBOSE: Performing the operation "Set Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\aTest Property: Test01".
VERBOSE: Performing the operation "Set Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\aTest Property: Test02".
VERBOSE: Performing the operation "Set Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\aTest Property: Test03".
VERBOSE: Performing the operation "Set Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\aTest Property: Test04".
VERBOSE: Performing the operation "Set Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\aTest Property: Test05".
VERBOSE: Performing the operation "Set Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\aTest Property: Test06".
VERBOSE: Performing the operation "Set Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\aTest Property: Test07".
VERBOSE: Performing the operation "Set Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\aTest\`. Property: Test08".
VERBOSE: Performing the operation "Set Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\aTest Property: Test09".
VERBOSE: Performing the operation "Set Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\aTest Property: Test10".
VERBOSE: Performing the operation "Set Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\aTest\`. Property: Test11".
VERBOSE: Performing the operation "Set Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\aTest Property: Test12".
VERBOSE: Performing the operation "Set Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\aTest\ Property: Test13".
VERBOSE: Performing the operation "Set Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\aTest\ Property: Test14".
VERBOSE: Performing the operation "Set Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\aTest\ Property: Test15".
VERBOSE: Performing the operation "Set Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\aTest\ Property: Test16".
VERBOSE: Performing the operation "Set Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\aTest\ Property: Test17".
VERBOSE: Performing the operation "Set Property" on target "Item: HKEY_LOCAL_MACHINE\SOFTWARE\aTest\ Property: Test18".
Пожалуйста, что мне не хватает?