in reply to Net::SSH2 some programs launch but can't get my script to run

I tested it with (eg Calc.exe, Notepad.exe, the Padre IDE...) but I can't get it to start and display cmd.exe or batch file execution window

Looks to me that the problem must be with the contents of the batch file.
What's the command (in the batch file) that successfully starts Notepad.exe ?
What's the command (in the batch file) that fails to start cmd.exe ?

Cheers,
Rob
  • Comment on Re: Net::SSH2 some programs launch but can't get my script to run

Replies are listed 'Best First'.
Re^2: Net::SSH2 some programs launch but can't get my script to run
by Porax (Acolyte) on Oct 21, 2014 at 07:44 UTC

    Hi Rob !

    Here is my batch file

    Title "Title" set PATH=%PATH%;C:\perlPath\perl\bin\bin;C:\path C:\perlPath\Perl.exe C:\path\script.pl @Pause

    My script is started (I can see the cmd an perl processes spawning) but remains undisplayed.

    to start calc.exe for my tests I use :

    start c:/windows/system32/calc.exe

    It works and the calculator is normally displayed

    Thank for any idea that could come to your mind :)

    Porax

      You're not really doing anything to create a cmd.exe console and keep it alive.
      C:\sisyphusion>type script.pl use warnings; print "Hello World\n"; C:\sisyphusion>type try.bat @echo off set PATH=C:\MinGW\perl516\bin;C:\MinGW\bin;%PATH% @echo on cmd /k perl script.pl C:\sisyphusion>
      When I double click on 'try.bat' I get a cmd.exe console pop up that contains:
      C:\sisyphusion>cmd /k perl script.pl Hello World C:\sisyphusion>
      I think you should be able to make use of that approach, too.
      It's the "/k" switch that keeps the cmd.exe console alive. If you use "/c" instead, then the cmd.exe console closes as soon as the perl script has finished executing.
      (The "@echo off" and "@echo on" merely conceal the output of the "set PATH" command - you probably already know that.)

      Cheers,
      Rob

        Tried the "/k" but it sadly didn't change a thing.

        The batch is working fine when I start it with a double click, also I don't really need to care about keeping the console alive as the script is an infinite loop processing files continuously provided by another app.

        At the moment the batch started through SSH is actually executed and keeps running (stays in the task manager), the only problem left is for it to display properly on the Desktop.

        After my last tries I think the problem might be with cygwin. I have a c:\Cygpath\bash.exe process running that may be encapsulating my actual command and prenventing its display. I will have a look in this direction.

        Thanks for the suggestions !

        Still up for more ideas !

        Porax