Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Operating System - Microsoft
Showing results for 
Search instead for 
Did you mean: 

Perl in Windows Environment Help

Go to solution
Steven Chen_1
Super Advisor

Perl in Windows Environment Help


Being new to perl, I would like to get help with working in windows/dos environment on schedule basis (not execute manually from cmd):

1) do we need a batch file to execute the perl file?
2) does the perl need an extention as .pl?
3) what is the syntac on the first line of perl in windows:


(not in Unix environment!)

Any help is very appreciated!

A. Clay Stephenson
Acclaimed Contributor

Re: Perl in Windows Environment Help

You should associate a .pl extension with perl.exe but that is not necessary. I assume that since you are asking this question under OB2/DP that this is an OB2/DP related question so there are a few things you have to do to make Perl work as a pre/post-exec script.

1) If you have installed Perl under Program Files, I suggest that you uninstall and install it under C:\Perl. This makes life simpler because your scripts and the data specifications don't have to be so careful about correctly quoting pathnames with embedded white space.

2) You actually have to copy 2 Perl files to your %OmniBack% bin directory (and once again, I suggest that you install OB2/DP in C:\OmniBack) so that you don't have to deal with white space. It's much easier to remove and reinstall DP that it is to deal with obscure scripting problems. In any event, you need to copy perl.exe and perl58.dll (or whatever version you are using) to the %OmniBack%\bin directory.

3) Your Perl script(s) also should be installed in the %OmniBack%\bin directory. (C:\OmniBack\bin on my Windows boxes).

4) Edit your data specification and add a line similar to this:

-pre_exec "perl.exe -I C:/Perl/lib -I C:/Perl/site/lib C:\OmniBack\bin\"

to the backup object.

This will execute as a pre-exec.
Make sure that your script explicitly exits with an appropriate return value (e.g. 0 if all is well).

If it ain't broke, I can fix that.