http://www.perlmonks.org?node_id=11107682


in reply to Re: [implementation specific to windows] writing a proper batch file for terminal start-up
in thread [implementation specific to windows] writing a proper batch file for terminal start-up

When I double-click on a PL file, I associated it with RUN.BAT, so when I click to open, it runs and the terminal window stays open until I press enter.

I have been reseaching and puzzling on this response and thank you for it. Right now, when I click on a .pl, a dos terminal with strawberry perl exe on the top appears, executes the program and then disappears before I can lay eyes on it. This would be a great time to change this. In this script:

@ECHO OFF C:\BIN\PERL\TINYPERL -I C:\BIN\PERL\LIB "%1" %2 %3 ECHO. PAUSE

, what are to be %2 %3 ?

I have been trying to replicate what I see here and at this link another link, but I seem to have come up short in a command prompt in administrator mode:

PS C:\Strawberry> Ftype Perl_program_file="C:\Strawberry\perl\bin\perl +.exe" %1 Ftype : The term 'Ftype' is not recognized as the name of a cmdlet, fu +nction, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the p +ath is correct and try again. At line:1 char:1 + Ftype Perl_program_file="C:\Strawberry\perl\bin\perl.exe" %1 + ~~~~~ + CategoryInfo : ObjectNotFound: (Ftype:String) [], Comma +ndNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Strawberry>

The assoc command works here:

C:\Users\tblaz>assoc .pl .pl=Perl_program_file C:\Users\tblaz>

When I try to fold this into a useful batch file, Perl_program_file doesn't seem to do anything yet:

@echo off rem set env variables set TERM=dumb set PERL_JSON_BACKEND=JSON::XS set PERL_YAML_BACKEND=YAML rem avoid collisions with other perl stuff on your system rem set PERL5LIB= set PERL5OPT= set PERL_MM_OPT= set PERL_MB_OPT= perl -e "printf("""Perl executable: %%s\nPerl version : %%vd\n""", $ +^X, $^V)" 2>nul if ERRORLEVEL==1 echo.&echo FATAL ERROR: 'perl' does not work; check i +f your strawberry pack is complete! Ftype Perl_program_file="C:\Strawberry\perl\bin\perl.exe" %1 ECHO. PAUSE

When I double click on the .bat file that this is I get:

Perl executable: C:\Strawberry\perl\bin\perl.exe Perl version : 5.30.0 File type 'Perl_program_file' not found or no open command associated +with it. Press any key to continue . . .

At least I can read the output, but I'm not getting this yet. Do I need to create a .reg file to reassociate .pl?