473,240 Members | 1,724 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,240 software developers and data experts.

How to Call a Batch file for execution from a perl script

I need to call a batch file for execution through the perl script.pz help
Feb 22 '08 #1
6 24357
410 Expert 256MB
I need to call a batch file for execution through the perl script.pz help
Use system command.
Expand|Select|Wrap|Line Numbers
  2. system("start C:\\Temp\\mybatchfile.bat");   # run the batch file
  3. sleep 15;  ### wait 15s for execution before proceeding
Feb 22 '08 #2
971 Expert 512MB
Please read the "Guidelines To Ensuring Better Answers and Assistance To Your Thread(s)"

Feb 22 '08 #3
Hello, nithinpes i am trying to run a batch file which is located in Documents and Settings folder. I get the error as windows can not find the path "c:Documents\. How to fix this error?
Sep 23 '10 #4
410 Expert 256MB
If the path contains spaces, then the entire path needs to be escaped within quotes (quoted command should be passed to system).

Expand|Select|Wrap|Line Numbers
  1. system("start \"C:\\Documents and Settings\\mybatchfile.bat\"");
Sep 23 '10 #5
Thank you nithinpes. I have small doubt. Should the batch be in C folder only to be executed? Cos I have my batch file in D drive. When i try to run batch file individually, it runs and gives me corresponding output. But, when I try to run from perl script, it wont run. Also, I wont get any error message. What might be the problem?
Sep 24 '10 #6
when the path contains spaces, replace the folder names with their windows names.
To get windows names of the folders, just use command dir /x.
it will solve spaces problem.
Oct 7 '10 #7

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

Similar topics

by: SeeBelow | last post by:
I have not been able to find a simple way to have a python script execute an MS-DOS program repeatedly. execv(), for example, won't run it more than once. I have been using many lines of a .bat...
by: KMiller | last post by:
My batch file is attempting to copy two files. The first copy works fine, but the second one does not fire when it executes from the Microsoft installer. Code looks like this: @echo off Rem...
by: Zeya | last post by:
I have created a very simple batch file and trying to retrieve the standard output but everytime I run the code it returns ExitCode as 1. I have created a batch file as simple as ping localhost...
by: Nurit N | last post by:
Hi, I have created a very simple batch file (echo hello world) and was trying to retrieve the standard output but every time I run the code it returns ExitCode as 1. The batch file runs just...
by: RadhakrishnanR | last post by:
Hi, I have created batch file (plz see bellow). This batch file copy the text file from FTP server. I have bellow query: 1. This bellow batch file how to call from VB6.0 application (Not in .Net...
by: hughie | last post by:
Has anyone done this? A windows webserver has a share on the same computer that contains some dos batch files. I'm trying to write a php page that will execute them. After much thrashing around...
by: chitralaxman | last post by:
i am in need to run an .exe file from perl script and that exe file should accept an input from another file. please give me the solution to run an exe file from perl script
by: senthilkumars | last post by:
i am running my perl script as "perl script.pl /root/sample/shadow .htpasswd" now i need to pass these inputs in separate file and read from that file. for eg content of file may be...
by: lilly07 | last post by:
Hi, I have to call ' java -jar name.jar arg1 arg2' in my perl script. The java prints a string if we invoke the above command How to capture this information. Thanks and regards.
by: raghusln | last post by:
How to call sequence of batch files from perl script
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.