[resolved] execute ssh commands with putty from a .bat

Solved
Hello,

I'm trying to execute some commands with putty from a batch file, but I don't seem to be having any luck.
The commands I'm trying to execute are just (for now) opening the midori browser on my remote host (a raspberry), so here are the codes I have for now:

My .bat file:
start /w putty.exe -load "SESSION" -l pi -pw raspberry -m commands.txt

and my commands.txt file:
export DISPLAY=:0
midori -e Fullscreen -a http://192.168.1.50

These commands work perfectly when I type them manually, but when I run the .bat, a window just opens and closes...

Thanks to anyone who can help :)

Edit:
Okay, I didn't capitalize DISPLAY...
everything works!

Configuration: Windows 7 / Firefox 47.0

2 answers

  • Votes
  • Date
  • Descending date
  1. Contributor
    Hi,

    Thank you for the feedback.

    Two small things:
    • Gnu/Linux is case-sensitive (unlike Windows)
    • Environment variables are always defined in uppercase


    --
    _______________________________ ☯ Zen my nuggets ☮ ______________________________
    Make a gesture for the environment, close your windows and adopt a penguin… 🐧
    1. Actually, I'm going to repost because it's a continuation...

      The commands are executing well but the window doesn't close... I have to close it manually :/
      Is there a command to make it close automatically after execution?
      1. Contributor
        But the window won't close
        Which window? The one from Putty?
      2. yes, the one that opens as soon as the script is launched
        (actually, I have two open, probably the one from the batch and the one from putty....)
      3. Contributor
        @roideseauxWhen you manually close the batch window, does the browser continue to run or does it close as well?
      4. It keeps spinning (by the way, when entering the command manually, if I close it, it also closes the browser!)
      5. Contributor
        @roideseauxWhen entering the command manually, you must launch the command with
        nohup
        to detach it from the terminal.

        Or followed by "&" to run it in the background and regain control of the terminal.

        Otherwise, for your issue, try adding an
        exit
        at the end of your command file.