Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^5: system sub routine with windows7

by Njoud (Initiate)
on Jun 28, 2013 at 18:39 UTC ( #1041315=note: print w/replies, xml ) Need Help??

in reply to Re^4: system sub routine with windows7
in thread system sub routine with windows7

Thank you, you are really helpful. But I do not want to run glomosim.exe , what I want is to run the command (glomosim on CMD.exe ! So I tried to write :

my @args = ("c:\\Windows\\System32\\cmd.exe","c:\\glomosim\\bin\\data. +in"); system(@args) == 0 or die "system @args failed: \n syscode:$? \ +n error:$! \n";

but I get nothing !! Microsoft windows version ..... etc ! How I can pass a command (glomosim to cmd.exe ? Thank you very much.

Replies are listed 'Best First'.
Re^6: system sub routine with windows7
by marto (Archbishop) on Jun 28, 2013 at 19:36 UTC

    Don't worry about it, we're here to help. The weirdness you're seeing "Microsoft windows version..." is the output of running cmd.exe. If you did a Start->Run->cmd.exe then you'd see something like:

    Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\marto>

    What you want to do with system is run a comand called glomosim, and pass an input file. So the first part in the example I gave you was to a program called glomosim.exe, if this isn't an executable you need to substite the command with whatever you want to run, not cmd.exe, so the general form of what you want to run is:

    my @args = ("c:\\path\\to\\glomosim","c:\\path\\to\\input.file");

    So you need to substite the path to the golomsim program and the path to the input file in the above example. In Re^2: system sub routine with windows7 I give some code to use to produce any errors. I have no idea what glomosim is, how it's executed, but if you substitute these values for the correct paths to the executable and input file we can provide further help if required.

      I have misunderstanding :( !. maybe I can't make my question be clear to you. the glomosim is a network simualtor , whatever , when I want to execute the file ( I go to cmd.exe and write the command (glomosim and press enter. So glomosim here is a command , as you have said, I want to pass this command (glomosim and run it on cmd.exe from perl. when I write :

      @args = ("glomosim", "c:\\glomosim\\bin\\"); system(@args) == 0 or die "system @args failed: $?";
      I got the error : can't spawn "cmd.exe" : No such file or directory at line 71 system glomosim c:\glomosim\bin\ failed ... I am beginner with perl and using windows7, so sorry for my many questions. :) Thank you

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1041315]
[marto]: good morning all

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2018-06-20 08:38 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (116 votes). Check out past polls.