8

I just want to add Python to the tab options of windows terminal app. I extracted GUID with following code in powershell

>>     [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)'

I edited the setting.json with following code but nothing appear in the option menu. What am I doing wrong here?

      {
      "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\\"
      }
Aakash Gautam
  • 171
  • 1
  • 6

1 Answers1

9
      {
        "guid" : "{a2a37ca0-8ebd-4d7e-b4b8-e6b1740c2ce0}",
        "name" : "Python",
        "commandline" : "py.exe",
        "icon" : "C:/Users/Aakash Gautam/AppData/Local/Programs/Python/Python39/Lib/test/imghdrdata/python.png",
        "startingDirectory": "C:\\Users\\Aakash Gautam\\Desktop\\"
      }

I think the Problem was with commandline argument and forward slash in icon path.

Aakash Gautam
  • 171
  • 1
  • 6