473,414 Members | 1,636 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

perl.exe vs. cmd.exe

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
3 2496
KevinADC
4,059 Expert 2GB
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
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
4,059 Expert 2GB
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

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

Similar topics

4
by: Mark Wilson CPU | last post by:
This must be easy, but I'm missing something... I want to execute a Perl script, and capture ALL its output into a PHP variable. Here are my 2 files: -------------------------------------...
31
by: surfunbear | last post by:
I've read some posts on Perl versus Python and studied a bit of my Python book. I'm a software engineer, familiar with C++ objected oriented development, but have been using Perl because it is...
0
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile....
13
by: Otto J. Makela | last post by:
I'm trying to install to php the Perl-1.0.0.tgz package (from http://pecl.php.net/package/perl, enabling one to call perl libraries) to a pre-existing Solaris system. Unfortunately, the attempt...
6
by: surfivor | last post by:
I may be involved in a data migration project involving databases and creating XML feeds. Our site is PHP based, so I imagine the team might suggest PHP, but I had a look at the PHP documentation...
4
by: billb | last post by:
I installed a perl extension for PHP to use some perl inside my php primarily because I have perl working with oracle and not php and oracle. So I want to use my old perl scripts, and use the...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.