Hi
How to check the number of files in the %S variable?
How to check the number of files in the %S variable?
Moderators: Hacker, petermad, Stefan2, white
- ghisler(Author)
- Site Admin
- Posts: 50406
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: How to check the number of files in the %S variable?
That depends on the called program. For example, you can use the shift command in batch files to shift through all passed parameters.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: How to check the number of files in the %S variable?
you can write a powershell script like args.ps1
Code: Select all
Write-Host "You passed $($args.Count) arguments:"
$args | Write-Host
Read-Host -Prompt "Press any key to continue"
Code: Select all
TOTALCMD#BAR#DATA
pwsh %COMMANDER_PATH%\script\args.ps1
%S
@default.ps1
args
%COMMANDER_PATH%\script\
-1
Re: How to check the number of files in the %S variable?
%S has a limit on the length of the command line. This way you can get accurate data on the number of items:
Code: Select all
TOTALCMD#BAR#DATA
%COMMANDER_PATH%\Addons\TCFS2\TCFS2.exe /ef tcm(-1,1) "eval(settext_wait(`Marked items count: `msg(1074,msg(1074,1000)+1004),findwnd(Static,,findwnd(#32770))))"
%S:~,0
wciconex.dll,73
Number of marked items
Code: Select all
TOTALCMD#BAR#DATA
%COMMANDER_PATH%\Addons\TCFS2\TCFS2.exe /ef varset(1,msg(1074,1000)) tcm(-1,1) "eval(settext_wait(`Selected items count: `msg(1074,varget(1)+1004)?msg(1074,varget(1)+1004):if(msg(1074,varget(1)+1008),
msg(1074,varget(1)+1006)?1:0,1),findwnd(Static,,findwnd(#32770))))"%S:~,0
wciconex.dll,217
Number of selected items
Overquoting is evil! 👎