[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:
and my commands.txt file:
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
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
-
ContributorHi,
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… 🐧 -
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?-
-
-
Contributor@roideseauxWhen you manually close the batch window, does the browser continue to run or does it close as well?
-
-
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 anexit
at the end of your command file.
-