Calling sh script from Batch file....

May 26, 2012 at 11:18:48
Specs: Windows Vista
Hi all,

I have a following code that login into a unix server and FTP the file from unix server to my machine....I need to run a sh script and then make a FTP....how to code in a batch file...following is the code i am using:


set /p d=enter the day(dd)
set /p dt1=enter the month(mm)
set /p dt=enter the year(yy)
set /p yea=Also enter the century(yyyy)


@ECHO OFF

IF "%d"=="" GOTO Exit
IF "%dt"=="" GOTO Exit
IF "%dt1"=="" GOTO Exit
IF "%yea"=="" GOTO Exit

cd v:\GoldenHeart\TRD\output


> %0.ftp echo o 10.199.5.3
>> %0.ftp echo ******
>> %0.ftp echo ******
>> %0.ftp echo cd TRD_Report
>> %0.ftp echo cd data
>> %0.ftp echo cd output
>> %0.ftp echo bin
>> %0.ftp echo prompt
>>"Here I want to run TRD.sh script"
>> %0.ftp echo mget mget "TRD_report%dt%%dt1%%d%.xls"
>> %0.ftp echo mget mget "LGTSC04_%dt%%dt1%%d%.csv"
>> %0.ftp echo mget mget "LGTSC05_%dt%%dt1%%d%.csv"
>> %0.ftp echo mget mget "LGTSC01_%dt%%dt1%%d%.csv"
>> %0.ftp echo mget mget "KDMSC02_%dt%%dt1%%d%.csv"
>> %0.ftp echo bye
ftp -s:%0.ftp


I HAVE put in the my requirement above in double quotes so that you can understand at this place your support is required...

KINDLY HELP ME IN THIS REGARD. LOOKING FORWARD TO YOUR VALUABLE SUPPORT

Regards,
GoldenHeart2012


See More: Calling sh script from Batch file....

Report •

#1
May 27, 2012 at 06:00:01
Most FTP servers do not give you the ability to run arbitrary commands. Your best bet would be to use a telnet/ssh client to connect to the server in question to run your command. However, this requires third party tools to do so. If you have Vista, you might be able to use PowerShell to access .NET's System.Net.Sockets to emulate a telnet environment, but that's a lot of work.

How To Ask Questions The Smart Way


Report •

#2
May 27, 2012 at 10:07:42
Hi Razor2.3

Kindly help me with some example.....

BR///
GoldenHeart2012


Report •

#3
May 28, 2012 at 06:29:35
An example of a third party tool? I suggest plink, which is a part of PuTTY.

How To Ask Questions The Smart Way


Report •
Related Solutions


Ask Question