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

shrek123
Hi,

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
numberwhun
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;
  3.  
  4. system("c:\\Program\ Files\\Microsoft\ Office\\OFFICE11\\Outlook.exe");
  5.  
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.

Regards,

Jeff
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;
  9.  
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
eWish
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
savanm
85
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
KevinADC
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

2
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...
9
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...
36
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...
3
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...
3
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...
1
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...
2
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...
3
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. ...
2
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...
5
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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...
0
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
0
BarryA
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...
0
marktang
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,...
0
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...
0
jinu1996
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...
0
tracyyun
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.