Aak*_*tam 9 python windows-terminal
我只想将 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)'
Run Code Online (Sandbox Code Playgroud)
我使用以下代码编辑了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\\"
}
Run Code Online (Sandbox Code Playgroud)
{
"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\\"
}
Run Code Online (Sandbox Code Playgroud)
我认为问题在于命令行参数和图标路径中的正斜杠。
| 归档时间: |
|
| 查看次数: |
9157 次 |
| 最近记录: |