plink is closing after scriopt is executed in windows .bat file - windows

I am using .bat file to connect remote server to run an application, below is the .bat file
"C:\Program Files\PuTTY\plink.exe" -i "C:\Program Files\PuTTY\private.ppk" user_Name#20.223.45.63 "/path/Scripts/GetFolderList.sh /path/to/dir";
this is working fine, I mean this connecting to remote location but I am not getting output because of in windows task manager I can see the plink.exe and psftp.exe is not auto closing when close manually I get output.
I am not understand where is the mistake.
please help me out.
Thanks
Akshay Chakre

Related

Ftp Windows Command Line Command Not Working

I'm using Windows command line for getting some files from a ftp server.
I need to change the local directory during the session.
I tried using 'lcd' command but it's not working. I displayed that the command is executed correctly but when i download the files they are downloaded on another directory (default?).
Retyping 'lcd' to show the actual local directory i can see it does not change.
The code i used is written below
lcd C:\Myfolder\MySubFolder
I tryed also the cmd with administrative priviledges, but it is the same.
Thank You.

Opening Cygwin with Windows bat file and running script file

I require a tunnel between my windows machine to a UNIX server and wish to automate the process so that on startup the tunnel will be generated for me.
I installed Cygwin with ssh and autossh to connect to the remote server, built up the connection manually, and have confirmed that the connection works. The process involves 3 commands, which isn't a lot but something that would be great to have automated.
After creating a .sh script file, which includes my autossh connection commands, and saving it using Notepad ++ as a UNIX document (to avoid any potential conflicts regarding the file ending), I can navigate to this script in Cygwin and call bash script.sh. After which the connection is made and I can work on my server.
My problem comes when creating my bat file:
start /d "C:\cygwin\bin\" mintty.exe "C:\Users\user\Documents\Dev\" script.sh
The first part up to and including the .exe file works to open the Cygwin window, but I have been unsuccessful in feeding the script into it. I even tried including a --bash command before referencing the script file as follows, but I received an error that the command is unknown:
start /d "C:\cygwin\bin\" mintty.exe --bash "C:\Users\andrew\Documents\Development\" tunnel.sh
Does anyone know if and how it is possible to open a Cygwin window and call a script file within this window? This is my first time creating a bat file, so I hope this is perhaps a newbie problem that no one even bothers to post a solution online for...
you don't need start.
assuming your Cygwin is in C:\cygwin
you need just:
chdir c:\cygwin\bin
mintty /usr/bin/bash -l -c /cygdrive/c/Users/user/Documents/Dev/script.sh

Running a batch file through command prompt - system cannot find the path specified

I am trying to uninstall Oracle on this Windows 7 (64 bit) machine by downloading a standalone tool from Oracle, I need to run a batch file that is supposed to uninstall but I am unable to run it.
I tried to open command prompt as administrator and I am trying to run this as below:
As you can clearly see from the screenshot, I am doing a "dir" on the directory and can clearly see the file right there. Not sure what's going on here.
I also tried to run the batch file by double clicking from Windows Explorer and a terminal window opens and closes quickly but the batch file is not doing what it is supposed to do (it is clearly not executing from Windows Explorer).
Can anyone help me with this?
As theB pointed out above in a comment, this worked for me:
Open the bat file in notepad. I'll bet it starts with #echo off, and
that the error is actually coming from inside the batch file. The
error if the batch file itself wasn't found is 'X' is not recognized
as an internal or external command, operable program or batch file
'Run as Administrator' changes the current directory. See my answer here
Difference between "%~dp0" and ".\"?

Running a bat file in background in windows

I need to run a bat file in background in windows.
I have tried using theSTART command.
The problem is, I connect to this machine remotely & if I log off, then the process gets killed.
Is there any way to keep a bat file running even after I log off from the remote machine?
Thanks in advance
Srvany: http://support.microsoft.com/kb/137890
RunAsService: http://runasservice.sourceforge.net/
Nssm: http://nssm.cc/
If you execute the bat file from a Windows service (using a service account) you will be able to log off and have the bat file execute in the background.
This walkthrough might be handy
http://msdn.microsoft.com/en-us/library/zt39148a(v=vs.110).aspx

Opening command prompt at Windows startup

I have an application that runs (listens to incoming TCP data) from the command prompt. How can I make the command prompt open at Windows Startup and get to the following:
C:/wamp/php/php test.php
where "test.php" is the file that
add it to the startup folder (start menu).
I got a solutin to my own question:
I created a batch file with commands that redirect to the file (c:\wamp\php\php test.php). I then pinned the file on the startup folder. It works fine.

Resources