ContextMenuForWindows11 icon indicating copy to clipboard operation
ContextMenuForWindows11 copied to clipboard

Feature Request: Executing a command instead of a shortcut.

Open bropines opened this issue 1 year ago • 5 comments
trafficstars

This is now. image

It's desirable image

Maybe I can use the command, but it's not working for some reason. Also a question, is it possible to add hidden startup of batches, or commands, so that they do not open a console window every time

bropines avatar Jul 14 '24 20:07 bropines

Executing a command instead of a shortcut

don't know what you mean... The "exe" does not need to add parameters

exe: ssh
param: [email protected]
or
exe: cmd.exe
param: cmd /k ...

but will add a switch to hide the window

ikas-mc avatar Jul 20 '24 02:07 ikas-mc

Executing a command instead of a shortcut

don't know what you mean... The "exe" does not need to add parameters

exe: ssh
param: [email protected]
or
exe: cmd.exe
param: cmd /k ...

but will add a switch to hide the window

There is a plugin in flow launcher https://github.com/mantasjasikenas/flow-launcher-shortcuts-plugin which allows you to stupidly run a command when running a shortcut. moreover, you can choose which terminal manager to do this through. it would be nice to make a separate field for the usual commands run from the console (cmd, pwsh, powershell(pwsh = powershell 7).

bropines avatar Jul 20 '24 12:07 bropines

as a last resort, you can give the user to specify his terminal application if he has installed some kind of left analog of powershell

bropines avatar Jul 20 '24 12:07 bropines

And how can I compile a package?

bropines avatar Aug 30 '24 01:08 bropines

u can build from source or use msix editor to modify package

1.build from source

install vs2019 with desktop uwp sdk https://github.com/ikas-mc/ContextMenuForWindows11/blob/main/build.md and https://github.com/ikas-mc/ContextMenuForWindows11/blob/main/.github/workflows/build.yml

2. msix editor

https://github.com/ikas-mc/ContextMenuForWindows11/wiki/Create-Custom-Package

ikas-mc avatar Aug 30 '24 03:08 ikas-mc

Any way to execute some command like Copy-Item? I want to implement a "Duplicate here" button but have found no way. Even cmd.exe -> (here is the execute command) doesn't work

gheescoo avatar Nov 10 '25 14:11 gheescoo

@gheescoo use poweshell script

{
  "title": "Duplicate Here",
  "index": 101,
  "exe": "powershell.exe",
  "param": "-NoProfile -ExecutionPolicy Bypass -File \"C:\\Users\\test\\Documents\\scripts\\duplicate-file.ps1\" \"{path}\"",
  "icon": "%SystemRoot%\\System32\\shell32.dll,54",
  "acceptDirectoryFlag": 0,
  "acceptFileFlag": 4,
  "acceptMultipleFilesFlag": 0,
  "showWindowFlag": -1
}
param(
	[string]$p,
	[string]$suffix = '-Copy'
)
if(!$p){$p=Read-Host 'no input file path'}
if(!(Test-Path -LiteralPath $p)){Write-Error 'file not exists'; exit 1}

$dir = Split-Path -Parent $p
$name = [IO.Path]::GetFileNameWithoutExtension($p)
$ext  = [IO.Path]::GetExtension($p)

function Get-NewName([string]$dir,[string]$name,[string]$ext,[string]$suffix){
	$first = Join-Path $dir ($name + $suffix + $ext)
	if(!(Test-Path -LiteralPath $first)){ return $first }
	$i = 2
	while($true){
		$cand = Join-Path $dir ("{0}{1} ({2}){3}" -f $name,$suffix,$i,$ext)
		if(!(Test-Path -LiteralPath $cand)){ return $cand }
		$i++
	}
}

$dst = Get-NewName $dir $name $ext $suffix
Copy-Item -LiteralPath $p -Destination $dst -Force
$dst

change C:\Users\test\Documents\scripts\duplicate-file.ps1 to your path

duplicate-file.zip

ikas-mc avatar Nov 11 '25 07:11 ikas-mc