Perl does not process through my batch file

Hello everyone,

first of all I have no clue about Perl scripts, ActivePerl or programming languages whatsoever. I’ve been successfully running a certain tool via a perlscript in the past but that was Windows 7 times and I never got it to work again.
I recently downloaded ActiveState 5.36 and typed state auth and state checkout ActiveState-Projects/ActiveState-Perl-5.36.0 . in cmd.exe.
Thus, I believe ActivePerl has been successfully installed on my PC which is crucial for my tool to work.

Now this tool I have contains:
vwftool.pl
perl.bat
some other files (currently unnecessary).

the batch file, perl.bat, which used to work in the past contains the following line of code:
@echo off
vwftool.pl def.txt list.txt vwf_data1.asm
pause
exit

Just clicking on the batch file used to execute the perl file through ActivePerl and it created a .asm file.
This doesn’t work anymore, nothing happens except cmd.exe is opened and states:
Usage:definition.txt list.txt output.txt
Press any key to continue…

As I said it used to work, now does not anymore on my new PC. Any clues? Calling a perl file through a batch file seems like a pretty basic thing to me :slight_smile:

The output Usage:definition.txt list.txt output.txt seems to indicate that Windows located a version of Perl. However, installing ActiveState Perl would not have created an association between the Perl 5.36 executable and .pl files, so it may be some other version of Perl.

If you right click on the vwftool.pl file, and select properties, what do you see adjacent to ‘Opens with’?

The fact that you got the output Usage:definition.txt list.txt output.txt may indicate that the commandline arguments you entered, def.txt list.txt vwf_data1.asm, were not passed to the script. This is not an uncommon issue. It requires editing the Registry in order to fix it.

First, you need to know the location of perl.exe, so that you can search for it in the Registry.

The state checkout command would have installed Perl somewhere in your user AppData folder.

For your usage, a better alternative would have been:

state checkout ActiveState-Projects/ActiveState-Perl-5.36.0 --runtime-path <location of folder>

with <location of folder> replaced by the path to the location where you want Perl installed, e.g. C:\Perl-5.36 (in which case perl.exe is in C:\Perl-5.36\exec).

To open the Registry Editor, open the start menu, search for regedit, and then open the Registry Editor.

Then click on Find in the Edit menu, and search for the path to perl.exe, e.g. C:\Perl-5.36\exec.

Values for open commands like "C:\Perl-5.36\exec\perl.exe" "%1" need to be changed to "C:\Perl-5.36\exec\perl.exe" "%1" %*, i.e. %* must be added at the end.

It should be sufficient to put “perl vwftool.pl def.txt list.txt vwf_data1.asm” into the batch file!

That would work if the location of perl.exe is in PATH. Otherwise, attempting to execute perl would result in 'perl' is not recognized as an internal or external command.

Thanks for the answers everyone, I really appreciate your help, even though there is no need for me to try any solutions suggested. I fixed the problem by running the perl file through miniconda instead of a batch file, removing some argument lines in the perl file itself and instead insert this
&define(“def.txt”);
&convert(“list.txt”);
&create(“vwf_data1.asm”)
to hardcode the necessary .txt files that the perl file refers to.