Calling le inside batch script

I am writing a batch script that takes input args used for le script and runs the le command. I just have it taking the args from the command line and then calling the le command. This is my first batch script. I plan on expanding this script for user purposes.

::account key
set acckey=%1 

::domain csr
set domcsr=%2 

::domain key
set domkey=%3 

::domain crt
set domcrt=%4 

set domains=%5 

::absolute path to verification files
set path=%6 

::email tied to expiration of certificate
set email=%7 

::perl command to generate certificate
start C:\Dwimperl\le --key %acckey% --csr %domcsr% --csr-key %domkey% --crt %domcrt% --domains 
%domains% --path %path% --email %email% --live --unlink --generate-missing

When I run the command, I get the error The system cannot find the file C:\Dwimperl\le. I have tried doing just

le --key %acckey% --csr %domcsr% --csr-key %domkey% --crt %domcrt% --domains %domains% --path %path% --email %email% --live --unlink --generate-missing


start le --key %acckey% --csr %domcsr% --csr-key %domkey% --crt %domcrt% --domains %domains% --path %path% --email %email% --live --unlink --generate-missing


.\le --key %acckey% --csr %domcsr% --csr-key %domkey% --crt %domcrt% --domains %domains% --path %path% --email %email% --live --unlink --generate-missing

With each I receive the error

'le' is not recognized as an internal or external command, operable program or batch file.

I have been running the script inside the directory where perl and le are installed. The arguments get assigned correctly. I am unsure how to properly call le in the script.

@leader, how are people supposed to invoke on Windows? Do they explicitly call the Perl interpreter, like perl

Yes, if the user is not in the directory where the Perl interpreter is located, they can use C:\path\perl but if they are in the directory then just le can be called. The script is located inside the directory where the interpreter is.

If the Perl is installed, it would normally be expected that .pl extension is associated with it and the paths are set in the environment to find the scripts (which usually end up under perl\site\bin). If path to Perl is not set in the environment, then the best option is to specify a full path to the interpreter, giving the name of the script and its arguments as parameters (as mrcss mentioned). If it is a portable Perl (such as Strawberry Perl for example), then in a similar way the script and its parameters may be used with the appropriate wrapper (for Strawberry it would be portableshell.bat). And finally there are always binaries :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.