By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,848 Members | 1,359 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,848 IT Pros & Developers. It's quick & easy.

perl.exe vs. cmd.exe

P: 57
A few days ago, i was trying to make my perl script an executable (with no success). but that's not the direction of my question (at least not right now).

Once i stopped trying to make the executable work, i ran my perl script as a perl script (*.pl), but now when the console window comes up when it runs, i noticed that it's running through C:\Windows\system32\cmd.exe instead of C:\Perl\bin\perl.exe...which is causing the script to freak out and not run properly! The first line in my code is
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
which looks for the perl interpreter.

WHAT DID I DO?!?! And how can i get it back to normal and execute using perl.exe??

By the way (if this helps), i tried making the perl script an executable by using PAR and also Perl2Exe.
Mar 25 '08 #1
Share this Question
Share on Google+
3 Replies


KevinADC
Expert 2.5K+
P: 4,059
Windows does not use the shebang line. You can tell because it is ignoring your incorrect shebang line which is for a typical Linux computer. On winodws you can open a DOS window and type:

c:\>perl path\to\program.pl

or if perl is not in the command path:

c:\>perl\bin\perl.exe path\to\program.pl

that will run your perl script. If you want to click on your perl program and have it run you have to associate .pl with the perl executable. But that opens a dos/perl window, runs the program, and closes the dos/perl window, which may not be what you want to do. There is probably a way to make the window stay open, but I don't know how off the top of my head.
Mar 26 '08 #2

P: 57
If you want to click on your perl program and have it run you have to associate .pl with the perl executable.
Thanks Kevin, this is where the root of my question is...how do i associate the .pl with the perl executable when i just doubleclick to run it?

i know how to make the dos window go away while the script is running. i will use the following two lines:

Expand|Select|Wrap|Line Numbers
  1. my $hw = Win32::GUI::GetPerlWindow();
  2. Win32::GUI::Hide($hw);
Mar 26 '08 #3

KevinADC
Expert 2.5K+
P: 4,059
Thanks Kevin, this is where the root of my question is...how do i associate the .pl with the perl executable when i just doubleclick to run it?

i know how to make the dos window go away while the script is running. i will use the following two lines:

Expand|Select|Wrap|Line Numbers
  1. my $hw = Win32::GUI::GetPerlWindow();
  2. Win32::GUI::Hide($hw);
Since file association can be very different depending on what version of windows you are running, I suggest you ask on a Windows forum how to associate a file type with an executable. Or just try reading the Windows help files.
Mar 26 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.