【发布时间】:2021-05-15 03:26:36
【问题描述】:
我只想将 Python 添加到 windows 终端应用程序的选项卡选项中。我在 powershell 中使用以下代码提取了 GUID
>> [OutputType([System.Management.Automation.PSObject])]
>> [CmdletBinding()]
>> param (
>> [Parameter()]
>> [ValidateNotNullOrEmpty()]
>> [string]$Name
>> )
>>
>> $UninstallKeys = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall", "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
>> $null = New-PSDrive -Name HKU -PSProvider Registry -Root Registry::HKEY_USERS
>> $UninstallKeys += Get-ChildItem HKU: -ErrorAction SilentlyContinue | Where-Object { $_.Name -match 'S-\d-\d+-(\d+-){1,14}\d+$' } | ForEach-Object { "HKU:\$($_.PSChildName)\Software\Microsoft\Windows\CurrentVersion\Uninstall" }
>> if (-not $UninstallKeys) {
>> Write-Verbose -Message 'No software registry keys found'
>> } else {
>> foreach ($UninstallKey in $UninstallKeys) {
>> if ($PSBoundParameters.ContainsKey('Name')) {
>> $WhereBlock = { ($_.PSChildName -match '^{[A-Z0-9]{8}-([A-Z0-9]{4}-){3}[A-Z0-9]{12}}$') -and ($_.GetValue('DisplayName') -like "$Name*") }
>> } else {
>> $WhereBlock = { ($_.PSChildName -match '^{[A-Z0-9]{8}-([A-Z0-9]{4}-){3}[A-Z0-9]{12}}$') -and ($_.GetValue('DisplayName')) }
>> }
>> $gciParams = @{
>> Path = $UninstallKey
>> ErrorAction = 'SilentlyContinue'
>> }
>> $selectProperties = @(
>> @{n='GUID'; e={$_.PSChildName}},
>> @{n='Name'; e={$_.GetValue('DisplayName')}}
>> )
>> Get-ChildItem @gciParams | Where $WhereBlock | Select-Object -Property $selectProperties
>> }
>> }
>> }
PS C:\Users\AAKASH GAUTAM> Get-InstalledSoftware -Name 'Python 3.9.0 (64-bit)'
我使用以下代码编辑了 setting.json,但选项菜单中没有出现任何内容。我在这里做错了什么?
{
"guid": "{a2a37ca0-8ebd-4d7e-b4b8-e6b1740c2ce0}",
"commandline" : "C:\\Users\\AAKASH GAUTAM\\AppData\\Local\\Programs\\Python\\Python39\\python.exe",
"icon" : "C:\\Users\\Aakash Gautam\\AppData\\Local\\Programs\\Python\\Python39\\Lib\\test\\imghdrdata\\python.png",
"hidden": false,
"name": "Python",
"source": "Python.exe",
"closeOnExit" : true,
"startingDirectory": "C:\\Users\\Aakash Gautam\\Desktop\\"
}
【问题讨论】: