Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Version using Command Line #18529

Closed
auxtern opened this issue Apr 29, 2024 · 4 comments
Closed

Get Version using Command Line #18529

auxtern opened this issue Apr 29, 2024 · 4 comments

Comments

@auxtern
Copy link

auxtern commented Apr 29, 2024

The feature request

Is there a way to find out the version of Github Desktop installed using command line?

This is a simple thing but can be used to check whether the application is available or not just by running the "github" command in the terminal/cmd.

Proposed solution

For example, if you carry out the command

github '-version' or similar can display the currently installed desktop version of github.

github

Additional context

No response

@steveward
Copy link
Member

@auxtern thanks for the issue. There isn't a way to query the version using the command line -- are you only wanting this to check if the app is running? There's likely a way to script this using available tools like PowerShell without something needing to be directly added to GitHub Desktop.

@steveward steveward added the more-info-needed The submitter needs to provide more information about the issue label Apr 29, 2024
@auxtern
Copy link
Author

auxtern commented Apr 30, 2024

Thank you for your answers. I don't want to check the application is running or not. But want to check whether it is installed or not and get the version. Is it possible to get the same version information as in this control panel:
github-2

@github-actions github-actions bot removed the more-info-needed The submitter needs to provide more information about the issue label Apr 30, 2024
@auxtern
Copy link
Author

auxtern commented Apr 30, 2024

For now you can use power shell:
github

app.ps1

param (
    [string]$programName
)

if (!([Diagnostics.Process]::GetCurrentProcess().Path -match '\\syswow64\\')) {
  $uninstallPath = "\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
  $uninstallWow6432Path = "\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"

  $results = @()

  if (Test-Path "HKLM:$uninstallWow6432Path") { $results += Get-ChildItem "HKLM:$uninstallWow6432Path" }
  if (Test-Path "HKLM:$uninstallPath") { $results += Get-ChildItem "HKLM:$uninstallPath" }
  if (Test-Path "HKCU:$uninstallWow6432Path") { $results += Get-ChildItem "HKCU:$uninstallWow6432Path" }
  if (Test-Path "HKCU:$uninstallPath") { $results += Get-ChildItem "HKCU:$uninstallPath" }

  $filteredResults = $results | ForEach-Object {
    if ($_.PSPath) {
        try {
            $itemProperty = Get-ItemProperty $_.PSPath -ErrorAction Stop
            return $itemProperty
        } catch {
            return $null
        }
    } else {
        continue
    }
  } | Where-Object {
    $_.DisplayName -and !$_.SystemComponent -and !$_.ReleaseType -and !$_.ParentKeyName -and ($_.UninstallString -or $_.NoRemove)
  } | Sort-Object DisplayName

  $filteredResults | ForEach-Object {
    if ($_.DisplayName -eq $programName) {
        "$($_.DisplayName)||$($_.DisplayVersion)"
    }
  }

}

@steveward
Copy link
Member

I'll close this out as this isn't something we've heard previous feedback about, but thanks for sharing that script for others to make use of!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants