I'm currently running 32-bit Windows XP Pro with TinyPerl 5.8.0 here. This is the only perl on my computer located at C:\BIN\PERL. In that same folder I created a file called RUN.BAT, which contains the following:
@ECHO OFF
C:\BIN\PERL\TINYPERL -I C:\BIN\PERL\LIB "%1" %2 %3
ECHO.
PAUSE
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. It's a pretty simple solution. (I don't have any environmental variables set for perl. I just pass the necessary values in the command line.)
I have also downloaded an icon that looks like a blue script thingy. And I created a REG file, which ties the PL and PM and CGI extensions to that icon file. So, all PL files on my computer appear with that little blue icon. I can very easily distinguish perl scripts from other files.
So, the PERL.REG file looks like this:
REGEDIT4 [HKEY_CLASSES_ROOT\pm_auto_file] [HKEY_CLASSES_ROOT\pm_auto_file] @="" [HKEY_CLASSES_ROOT\pm_auto_file\DefaultIcon] [HKEY_CLASSES_ROOT\pm_auto_file\DefaultIcon] @="C:\\BIN\\PERL\\PERL.ICO" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\pm_auto_file] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\pm_auto_file\DefaultIcon] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\pm_auto_file\DefaultIcon] @="C:\\BIN\\PERL\\PERL.ICO" [HKEY_CLASSES_ROOT\cgi_auto_file] [HKEY_CLASSES_ROOT\cgi_auto_file] @="" [HKEY_CLASSES_ROOT\cgi_auto_file\DefaultIcon] [HKEY_CLASSES_ROOT\cgi_auto_file\DefaultIcon] @="C:\\BIN\\PERL\\PERL.ICO" [HKEY_CLASSES_ROOT\cgi_auto_file\shell] [HKEY_CLASSES_ROOT\cgi_auto_file\shell\edit] [HKEY_CLASSES_ROOT\cgi_auto_file\shell\edit\command] @="\"C:\\Windows\\system32\\notepad.exe\" \"%1\"" [HKEY_CLASSES_ROOT\cgi_auto_file\shell\open] [HKEY_CLASSES_ROOT\cgi_auto_file\shell\open\command] @="\"C:\\BIN\\PERL\\runcgi.bat\" \"%1\"" [HKEY_CLASSES_ROOT\pl_auto_file] [HKEY_CLASSES_ROOT\pl_auto_file] @="" [HKEY_CLASSES_ROOT\pl_auto_file\DefaultIcon] [HKEY_CLASSES_ROOT\pl_auto_file\DefaultIcon] @="C:\\BIN\\PERL\\PERL.ICO" [HKEY_CLASSES_ROOT\pl_auto_file\shell] [HKEY_CLASSES_ROOT\pl_auto_file\shell\edit] [HKEY_CLASSES_ROOT\pl_auto_file\shell\edit\command] @="\"C:\\Windows\\system32\\notepad.exe\" \"%1\"" [HKEY_CLASSES_ROOT\pl_auto_file\shell\open] [HKEY_CLASSES_ROOT\pl_auto_file\shell\open\command] @="\"C:\\BIN\\PERL\\run.bat\" \"%1\"" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cgi_auto_file] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cgi_auto_file\DefaultIcon] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cgi_auto_file\DefaultIcon] @="C:\\BIN\\PERL\\PERL.ICO" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cgi_auto_file\shell] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cgi_auto_file\shell\edit] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cgi_auto_file\shell\edit\command] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cgi_auto_file\shell\edit\command] @="\"C:\\Windows\\system32\\notepad.exe\" \"%1\"" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cgi_auto_file\shell\open] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cgi_auto_file\shell\open\command] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cgi_auto_file\shell\open\command] @="\"C:\\BIN\\PERL\\runcgi.bat\" \"%1\"" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\pl_auto_file] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\pl_auto_file\DefaultIcon] @="C:\\BIN\\PERL\\PERL.ICO" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\pl_auto_file\shell] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\pl_auto_file\shell\edit] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\pl_auto_file\shell\edit\command] @="\"C:\\Windows\\system32\\notepad.exe\" \"%1\"" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\pl_auto_file\shell\open] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\pl_auto_file\shell\open\command] @="\"C:\\BIN\\PERL\\run.bat\" \"%1\""
When I click on CGI files, an entirely different script runs which saves the perl output as a html file and then opens it with Internet Explorer. So, I get to see what the output might look like if the script were to run on a server.
RUNCGI.BAT:
@ECHO OFF C:\BIN\PERL\TINYPERL -I C:\BIN\PERL\LIB "%1" > C:\BIN\PERL\OUTPUT.HTM C: CD "C:\Program Files\Internet Explorer" START IEXPLORE.EXE C:\BIN\PERL\OUTPUT.HTM EXIT
In reply to Re: [implementation specific to windows] writing a proper batch file for terminal start-up
by harangzsolt33
in thread [implementation specific to windows] writing a proper batch file for terminal start-up
by Aldebaran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |