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

Solved
roideseaux Posted messages 274 Status Member -  
roideseaux Posted messages 274 Status Member -
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

  1. zipe31 Posted messages 34620 Registration date   Status Contributor Last intervention   6 501
     
    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… 🐧
    0
  2. roideseaux Posted messages 274 Status Member 5
     
    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?
    0
    1. zipe31 Posted messages 34620 Registration date   Status Contributor Last intervention   6 501
       
      But the window won't close
      Which window? The one from Putty?
      0
    2. roideseaux Posted messages 274 Status Member 5
       
      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....)
      0
    3. zipe31 Posted messages 34620 Registration date   Status Contributor Last intervention   6 501 > roideseaux Posted messages 274 Status Member
       
      When you manually close the batch window, does the browser continue to run or does it close as well?
      0
    4. roideseaux Posted messages 274 Status Member 5
       
      It keeps spinning (by the way, when entering the command manually, if I close it, it also closes the browser!)
      0
    5. zipe31 Posted messages 34620 Registration date   Status Contributor Last intervention   6 501 > roideseaux Posted messages 274 Status Member
       
      When 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.
      0