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

Application command is missing additional command line arguments #35

Open
warrence2471 opened this issue Jul 11, 2024 · 1 comment
Open

Comments

@warrence2471
Copy link

Hi,

I have an issue with a particular application I want to set as default. Let's say I call
Register-FTA "r:\path\to\my.exe" .pl
Here in https://github.com/DanysysTeam/PS-SFTA/blob/master/SFTA.ps1#L140 the application command will then be set to
"r:\path\to\my.exe" "%1"
However, I need (and I have seen this on other default apps, too) something like
"r:\path\to\my.exe" "%1" %*
In order to send the rest of the call arguments to the default application. Do you have a solution for this? It would be easy for me to "fix" this in a copy/fork, but I am not sure how to allow for this and not break other use-cases. Extra optional parameter for the application command arguments?

Thanks!

@Danyfirex
Copy link
Contributor

I the meanwhile you could overwrite the registry key after run FTA with the required arguments using this part of the code:

  try {
    $keyPath = "HKEY_CURRENT_USER\SOFTWARE\Classes\$Extension\OpenWithProgids"
    [Microsoft.Win32.Registry]::SetValue( $keyPath, $ProgId, ([byte[]]@()), [Microsoft.Win32.RegistryValueKind]::None)
    $keyPath = "HKEY_CURRENT_USER\SOFTWARE\Classes\$ProgId\shell\open\command"
    [Microsoft.Win32.Registry]::SetValue($keyPath, "", $progCommand)
    Write-Verbose "Register ProgId and ProgId Command OK"
  }
  catch {
    throw "Register ProgId and ProgId Command FAILED"
  }

I think that can help while I update the code to allow extra text there.

Regards

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