How do I make a shortcut for a Perl program under Windows using a batch file?

0 votes
asked Mar 13, 2010 by micah

I'm trying to "hide" some of my Perl program from the end user to make things easier on them. I'm doing what I can to keep them out of the command prompt. The program itself has a GUI designed in Perl/Tk, so they don't have to worry about the command prompt.

Could I write out a quick batch file that goes along the lines of:

START perl 'C:\[some path here]\'

with START to start a program, the Perl interpretor as my program, and the path/name of my Perl script as the parameter?

Would I have to specify where to find perl or would Windows just know because perl is in the computer's PATH variable?

4 Answers

0 votes
answered Jan 13, 2010 by cjm

If the idea is to keep them away from the command line, why use a batch file at all? Why not just make a shortcut? (You could use Win32::Shortcut if you don't want to make one by hand.)

0 votes
answered Mar 13, 2010 by don-dickinson

you don't need "start" for this. either add perl.exe from your path or specify the full path to the perl interpreter.

so ... put this in your batch file:

c:\program files\perl.exe "c:\whatever\myscript.perl"


0 votes
answered Mar 14, 2010 by singingfish

I have a totally evil VBS script and batch file to deal with this kind of thing with Strawberry Perl Portable. The VBS script runs the batch file without spawning a cmd window. The batch file works out where it is, where perl.exe is relative to it, and runs the perl script. In this case it's to run a Catalyst server, but can be used for anything else too.

Here's the vbs (shudder):

Set fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) &  fso.GetParentFolderName(wscript.ScriptFullName) & "\perlshell.bat"& Chr(34), 0
Set WshShell = Nothing

And here's the batch script (only slightly less shudder):

echo off
set bindir=%~dp0
set perlpath=%bindir%perl\bin
set buildpath=%bindir%\bin
set PATH=%PATH%;%perlpath%;%buildpath%
"%perlpath%\wperl.exe" "%bindir%MyPhp\script\" -p 35900
0 votes
answered Sep 15, 2017 by coty-embry

There's an easier way. For windows:

Go to the desktop -> right click -> create a shortcut

make your target look like (i.e. the path to the perl.exe file) something like the following - I'll show you what mine looks like


In my case I have Strawberry Perl installed

right click desktop shortcut -> click properties

In the target input box, alter it to look something like mine:

C:\Strawberry\perl\bin\perl.exe D:\Developer\CustomTools\

where is the absolute path to my perl script

from there you should have a shortcut created to allow execution of a perl script.

In case you might be interested: in the properties popup you can also assign this invocation of the perl script to a keyboard button press and assign it a shortcut key to launch anytime ^_^

For me, I chose to do:


to stand for login - to invoke the script I wrote. be aware of default system keyboard combinations

If you have any questions, let me know!

Thanks for you time!

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter