If ".PL" is part of extension in PATHEXT variable and perl interpreter in the path and registered for .pl file this should have worked !
You can add before your script <PATH TP>\perl.exe.
If you want to debug the call, i ususally use for script cmd /k before the script command to see what is not working... and when it is debugged i remove it or change /k to /c.
nsp wrote: ↑2021-12-07, 06:44 UTC
If ".PL" is part of extension in PATHEXT variable and perl interpreter in the path and registered for .pl file this should have worked !
You can add before your script <PATH TP>\perl.exe.
If you want to debug the call, i ususally use for script cmd /k before the script command to see what is not working... and when it is debugged i remove it or change /k to /c.
".PL" is extension of perl script ,
PATHEXT variable and perl interpreter in the path
I can not understand this sentence very well
my perl.exe PATH "C:\Strawberry\perl\bin\perl.exe"
i ususally use for script cmd /k before the script command to see what is not working.
can you give me an example hyper link in this forum ?
[em_DeleteBlankLines]
cmd="C:\Strawberry\perl\bin\perl.exe %COMMANDER_PATH%\script\DeleteBlankLines.pl"
param="%L"
menu=call perl to delete blank lines
I success call perl script from total commander with your help ,thanks ,
and I make a bug in my perl script because of my unfamiliar with total commander's "%L"
thanks your help !
#perl script called by total commander to delete the blank lines of selected files
#time:20211209_171515
#running version:win7(64bit)+perl5.26.2+Total Commander version 10.00 64bit(2021-06-10)
#---------------------------em commander start---------------------------------------------------------------
#[em_DBLS]
#cmd="cmd /c %COMMANDER_PATH%\script\DeleteBlankLines.pl"
#param="%L"
#menu=call perl script to delete the blank lines of selected files
#if you want to debug the script,please use cmd="cmd /k %COMMANDER_PATH%\script\DeleteBlankLines.pl"
#---------------------------em commander end-----------------------------------------------------------------
use strict;use warnings;use diagnostics;
#Read the content of "%L" file and put it into the array @files, and each line of "%L" is a file name with a full path.
open(my $FH,"<","$ARGV[0]");#$ARGV[0] equals "%L"
my @files=<$FH>;
close($FH);
foreach my $file (@files)#modify the contents of every file
{
chomp($file);#delete the carriage return(you must remove the \n after the file name, otherwise there will be an error while reading this file!)
#open the file and read the contents of the file,save it into the array @data.
open(my $FHa,'<',$file);
my @data=<$FHa>;
close($FHa);
#Open the file again,wipe out the file,then write the modified contents into it.
open(my $FHb,'>',$file);
foreach my $line (@data)
{
chomp($line);#remove \n at the end of the line
#If matched the blank line,run next loop!
if($line=~m/^\s*$/)
{
next;
}
#Output the nonblank lines to the file
print $FHb "$line\n";
}
close($FHb);
}