473,434 Members | 1,559 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,434 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 23961
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.