大衛,
我不知道你是否已經找到了解決您的問題或沒有,但我在你的帖子出來,而研究辦法有一個PowerShell紙條禁用下的快速編輯選項編輯選項。據我所知,拉胡爾是正確的:「程序化」進行這種改變的唯一方法是通過註冊表。我知道你說過你不想更改註冊表,但有一種方法可以更改註冊表值,啓動新的PowerShell進程,在PowerShell進程中執行腳本塊,然後更改註冊表值。這是你會怎麼做:
假設必要的註冊表值不存在:
Set-Location HKCU:\Console
New-Item ‘.%SystemRoot%_System32_WindowsPowerShell_v1.0_Powershell.exe’
Set-Location ‘.%SystemRoot%_System32_WindowsPowerShell_v1.0_Powershell.exe’
New-ItemProperty . QuickEdit –Type DWORD –Value 0x00000000
Start-Process Powershell.exe 「&{ <#The scrip block you want to run with Quick Edit disabled#> }」
Set-ItemProperty . QuickEdit –Value 0x00000001
Pop-Location
假設必要的註冊表值不存在:
Set-Location HKCU:\Console
Set-Location ‘.%SystemRoot%_System32_WindowsPowerShell_v1.0_Powershell.exe’
Set-ItemProperty . QuickEdit –Value 0x00000000
Start-Process Powershell.exe 「&{ <#The scrip block you want to run with Quick Edit disabled#> }」
Set-ItemProperty . QuickEdit –Value 0x00000001
Pop-Location
如果你將這個代碼插入到您想要在禁用「快速編輯」的情況下運行腳本的一部分,您應該獲得所需的結果。希望這有助於。
-Cliff
我看到註冊表項可能是唯一的出路。 – Rahul
你想要什麼是不可能的。 –
@AnsgarWiechers你能給我多一點信息嗎?你怎麼會知道這事?例如,這是因爲相關的對象屬性沒有被暴露,或者它是如何在shell窗口中完成IO的根本問題?謝謝。 –