Batch Program

July 19, 2009 at 04:56:29
Specs: Windows XP
i have a requirement to write a ftp batch code which will get the IP Address, Username and Password from user. Once the user provides details, it establishes the ftp connection, if values are correct or else throw error.

Also if there is a way to prompt the user for correct value while entered a wrong value.For example username should be in characters and if mistakenly entered a number in between it should say invalid username before getting the password.

I am trying this batch programs for the first time and if somebody can suggest me of samples or how to do with a sample code, it could be of great help. Thanks


See More: Batch Program

Report •


#1
July 19, 2009 at 06:10:29
Start with psuedo-code.


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#2
July 19, 2009 at 10:51:24
Hi, U r trying a great thing,

I can help you creating a simple batch file which will ask you the username and password and login to the FTP, Can GET or PUT files,

But i am not sure that it will ask for password if wring entered.

Let me know if we should proceed?

Subhash Chandra.


Report •

#3
July 21, 2009 at 04:01:56
hi Thanks for you all your replies.

i tried a sample code as below:
echo on

SET /P ipaddr=Enter IPAddress:
SET /P uname=Enter Username:
SET /p pswd=Enter password:
echo.
> test.txt echo Open %ipaddr%
>> test.txt echo %uname%
>> test.txt echo %pswd%
>> test.txt echo pwd
ftp -s:test.txt

pause

wrote this to check whether i am successfully able to execute the batch file from the client n/w. When i execute this program i get the results as below:

C:\> test.bat
C:\> ftp ipaddress
C:\> username
'username is not recognised as an internal or external command, operable program or batch file
C:\> password
'username is not recognised as an internal or external command, operable program or batch file
C:\> pwd
'username is not recognised as an internal or external command, operable program or batch file

my test file contains correct details. any idea why its happening lik this?


Report •

Related Solutions

#4
July 21, 2009 at 04:03:50
C:\> test.bat
C:\> ftp ipaddress
C:\> username
'username is not recognised as an internal or external command, operable program or batch file
C:\> password
'password' is not recognised as an internal or external command, operable program or batch file
C:\> pwd
'pwd' is not recognised as an internal or external command, operable program or batch file

my test file contains correct details. any idea why its happening lik this?


Report •

#5
July 21, 2009 at 04:45:16
It seems like your script lost the OPEN.


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#6
July 23, 2009 at 16:28:33
your script should work , and working on my laptop as well.

if this is not working in ur NW , might some permissions issue or something.

try below.

------------------------------

SET /P ipaddr=Enter IPAddress:
SET /P uname=Enter Username:
SET /p pswd=Enter password:
echo.
> c:\test.txt echo Open %ipaddr%
>> c:\test.txt echo %uname%
>> c:\test.txt echo %pswd%
>> c:\test.txt echo pwd
ftp -s:c:\test.txt

pause

Subhash Chandra.


Report •


Ask Question