windows 从批处理文件调用 Perl 脚本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32400702/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Call Perl Script from Batch File
提问by monkeychef
I'm trying to make a batch file that will call a perl script that I have created that reports data every minute to a program. The program is not able to open perl scripts in Windows, but can collect data if a batch file opens the program.
我正在尝试制作一个批处理文件,该文件将调用我创建的 perl 脚本,该脚本每分钟向程序报告一次数据。该程序无法在 Windows 中打开 perl 脚本,但如果批处理文件打开该程序,则可以收集数据。
So far I have this:
到目前为止,我有这个:
@echo off
call "C:\[Perl Installation Location for reporting program]\manager\etc\perl.exe" "C:\[Script location on disk]\program.pl"
However this returns the error
但是这会返回错误
Can not find scrict.pm
找不到 scrict.pm
Any suggestions?
有什么建议?
Edit: Removing Use Strict and Use Warnings fixed the issue. Thanks!
编辑:删除使用严格和使用警告修复了这个问题。谢谢!
回答by Rajarshi
try this
尝试这个
inside the bat file
bat文件里面
cd /d script_path
perl tescript_name