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

Problem with system command on Windows


I want to do following operations:

1. Execute exe from perl script.
I am using following code:

system ("start \.\.\\Client\.exe");

Perl script is one directory up the directory where Client.exe is present.
My problem is that the it starts the client.exe with error. Actually the libraries that i have called in the exe program are not getting executed( or called).
I compiled Winbatch script to get Client.exe.

2. Open Outlook using perl script.

system ("start C:\\Program Files\\Microsoft Office\\outlook\.exe");

It gives an error saying system can not find the file "C;\Progrm".
Even if I use

system ("start C:\\Program\s Files\\Microsoft\sOffice\\outlook\.exe");

I gives an error: system can not find the file
"C;\ProgrmsFiles\MicrosoftsOffice\outlook.exe" .

Any direction to solve the problem would ba a great help.
Aug 23 '07 #1
5 23955
3,509 Expert Mod 2GB
First, I am going to assume that you are operating on a Windows operating system. That said, you are not escaping all of the spaces or other special characters. Take a look at this quick script that I just put together and tested. This worked fine:

Expand|Select|Wrap|Line Numbers
  1. use strict;
  2. use warnings;
  4. system("c:\\Program\ Files\\Microsoft\ Office\\OFFICE11\\Outlook.exe");
As you can see, not only did I double slash the entire path, but I also slash escaped the spaces in "Program Files" and "Microsoft Outlook". This is a must do to get that working.


Aug 23 '07 #2
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -w
  2. $dpath="\"C:\\Program Files\\VMware\\VMware Workstation\"";
  3. $vmdpath="\"C:\\Users\\vijay\\Documents\\Virtual Machines\"";
  4. printf "Enter the name of VM:";
  5. $name=<STDIN>;
  6. chomp $name;
  7. $cmd="$dpath\\vmrun start $vmdpath\\$name\\$name.vmx";
  8. system $cmd;
I was able to solve the issue of space in between "Program Files" & "VMware Workstation" using guidelines given above but when I ask user to enter the name of VM & if this "name" contains space like "suse linux 10.2" etc then again I am getting stuck at the same problem mentioned above
Nov 4 '07 #3
971 Expert 512MB
I would try this and see if it help your issue. Also use the strict pragma.

Expand|Select|Wrap|Line Numbers
  1. my $dpath=q{C:\\Program Files\\VMware\\VMware Workstation};
The q{} is like a single quote. If you use qq{} it is like using double quotes.
Nov 4 '07 #4
hi ..

this single line code is working well ...

system ("C:\\Program Files\\Microsoft Office\\office\\outlook.exe");

system ("C:\\Program Files\\Microsoft Office\\office\\POWERPNT.EXE");

I checked....

Check the path ...
Nov 5 '07 #5
4,059 Expert 2GB
You should be doing this:

Expand|Select|Wrap|Line Numbers
  1. my $cmd = 'C:/Program Files/Microsoft Office/office/outlook.exe';
  2. system($cmd);
Windows uses forward slashes or backslashes in directory paths, but backslashes in perl are meta characters and just confuse the issues when used needlessly. Also, use the correct quotes for the situation.
Nov 5 '07 #6

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

Similar topics

by: Xah Lee | last post by:
Python Doc Problem Example: os.system Xah Lee, 2005-09 today i'm trying to use Python to call shell commands. e.g. in Perl something like output=qx(ls) in Python i quickly located the...
by: Nathan Sokalski | last post by:
I am trying to connect to a Microsoft Access Database from my ASP.NET Application. I use the following code to create my connection string: cmdSelect.Connection = New...
by: AussieRules | last post by:
Hi, I want to use the user color scheme to set the color of my forms. I now I have to use the. System.Drawing.SystemColors, but which color is the color of a form background as used in other...
by: f1racing24 | last post by:
I am trying to compile this class in the command-line and this error comes up 'Start -> C:\Inetpub\wwwroot\DCReview_Brinkster\code>vbc /t:library /verbose...
by: Geraldine Hobley | last post by:
Hello, In my project I am inheriting several forms. However when I inherit from a form and add additional subroutines and methods to my inherited form I get all sorts of problems. e.g. I sometimes...
by: tassieboy | last post by:
Hi All I have a VB.NET application which runs on all client machines except one, where on startup, it gives the message system.enterpriseservices.thunk.dll, or one of its dependencies, were not...
by: gg9h0st | last post by:
php5.14, apache 2.0.58 windowsXp there's no problem running apache server with php. but i can't modify my php.ini file. when i tried to modify my php.ini in c:/php to load extensions, i...
by: Lambuz | last post by:
Hi all, I've got this problem. I've to implemente a solution like the example in http://support.microsoft.com/default.aspx?scid=kb;EN-US;313891, but I can't configure correctly the example. ...
by: explode | last post by:
I made nova oledbdataadapter select update insert and delete command and connection veza. dataset is Studenti1data, I made it by the new data source wizard,and made datagridview and bindingsource...
by: =?Utf-8?B?Z215ZXJz?= | last post by:
Hello, I am attempting to start a cmd.exe process and pass several .vbs scripts (with additional parameters) and then read the output from the scripts and make "notes" in a DataTable (the...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
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,...
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...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.