How to see the bat log file
Moderator: DosItHelp
How to see the bat log file
Good Morning All,
I created a bat file, the purpose is it uses the winscp script to copy a file from windows to unix. When i execute the bat file the window quikly appears and disappears and nothing happens. Can anyone please tell me the process to create a log file so that i can look into the error messages. Greatlly appreciate your help
I created a bat file, the purpose is it uses the winscp script to copy a file from windows to unix. When i execute the bat file the window quikly appears and disappears and nothing happens. Can anyone please tell me the process to create a log file so that i can look into the error messages. Greatlly appreciate your help
Re: How to see the bat log file
Would help to see the batch file you are using.
In general though, make sure ECHO is ON and execute the batch file from the cmd prompt instead of double clicking it with your mouse.
In general though, make sure ECHO is ON and execute the batch file from the cmd prompt instead of double clicking it with your mouse.
Re: How to see the bat log file
Thanks Squashman,
The script is below
script option batch on option confirm off open sftp://username:pwd@server:22 -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" cd /u01/EnvironmentStartup option transfer binary put -preservetime winscp.txt c:\
close exit But when i use "*.txt" insted of winscp.txt its working and copying all the .txt files onto the linux server.
where should i put the ECHO ON?
The script is below
script option batch on option confirm off open sftp://username:pwd@server:22 -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" cd /u01/EnvironmentStartup option transfer binary put -preservetime winscp.txt c:\
close exit But when i use "*.txt" insted of winscp.txt its working and copying all the .txt files onto the linux server.
where should i put the ECHO ON?
Re: How to see the bat log file
If you copy and paste your code using the CODE tags in the forum editor, when you post, then we can see your batch file correctly.
Squashman suggested that you launch the batch file from a cmd prompt
- and that is the advice you should pay attention to because you will see the error messages.
Squashman suggested that you launch the batch file from a cmd prompt
- and that is the advice you should pay attention to because you will see the error messages.
Re: How to see the bat log file
option batch on
option confirm off
open sftp://username:pwd@server:22 -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
cd /u01/EnvironmentStartup
option transfer binary
put -preservetime winscp.txt c:\
close
exit
Re: How to see the bat log file
foxidrive wrote:If you copy and paste your code using the CODE tags in the forum editor, when you post, then we can see your batch file correctly.
Squashman suggested that you launch the batch file from a cmd prompt
- and that is the advice you should pay attention to because you will see the error messages.
Thanks Foxidrive i did run it from the command prompt and it is doing the same, a window appears and disappears in a second.
Re: How to see the bat log file
bkandala wrote:Code: Select all
option batch on
option confirm off
open sftp://username:pwd@server:22 -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
cd /u01/EnvironmentStartup
option transfer binary
put -preservetime winscp.txt c:\
close
exit
That is a script for a third party tool - and not a batch script.
Re: How to see the bat log file
bkandala wrote:Thanks Foxidrive i did run it from the command prompt and it is doing the same, a window appears and disappears in a second.
The exit command at the end is closing the cmd window, but it isn't a batch script.
Re: How to see the bat log file
When I am having problems using a 3rd party utility I usually go straight to the source for help.
Winscp has their own support forum. And they have a category for scripting automation.
http://winscp.net/forum/index.php
Winscp has their own support forum. And they have a category for scripting automation.
http://winscp.net/forum/index.php
Re: How to see the bat log file
foxidrive wrote:bkandala wrote:Thanks Foxidrive i did run it from the command prompt and it is doing the same, a window appears and disappears in a second.
The exit command at the end is closing the cmd window, but it isn't a batch script.
Can you please tell what it is? It is doing the sftp part correctly when executed as a bat file
Re: How to see the bat log file
bkandala wrote:Can you please tell what it is? It is doing the sftp part correctly when executed as a bat file
Are you sure it is doing that?
Is there a batch file called open.bat or open.cmd somewhere?
I don't know which tool you are using. Squashman indicates it is winscp.
Re: How to see the bat log file
foxidrive wrote:bkandala wrote:Can you please tell what it is? It is doing the sftp part correctly when executed as a bat file
Are you sure it is doing that?
Is there a batch file called open.bat or open.cmd somewhere?
I don't know which tool you are using. Squashman indicates it is winscp.
when i right click on it ot double click on it , it copies the files from the local c drive to the said path on the linux box, however my problem is if i give a named text file its failing and if i give .*txt its working.
Also my main question was how to add a log file to the bat file so i can see if any errors are logged in there
Thanks
Re: How to see the bat log file
bkandala wrote:foxidrive wrote:bkandala wrote:Can you please tell what it is? It is doing the sftp part correctly when executed as a bat file
Are you sure it is doing that?
Is there a batch file called open.bat or open.cmd somewhere?
I don't know which tool you are using. Squashman indicates it is winscp.
when i right click on it ot double click on it , it copies the files from the local c drive to the said path on the linux box, however my problem is if i give a named text file its failing and if i give .*txt its working.
Also my main question was how to add a log file to the bat file so i can see if any errors are logged in there
Thanks
yes its winscp
Re: How to see the bat log file
Remove the exit command and try it.
Re: How to see the bat log file
foxidrive wrote:Remove the exit command and try it.
Tried that , its gives the following error message for each line in the script
'Option' is not recognized as an internal or external command, operable program or a batch file
I used the command at the command prompt:
start c:\test.bat