Articles

FTP User / Password

March 19, 2010 at 12:21:52
Specs: Windows XP

Trying to pass variables to FTP Script So that user is prompted each time for userid and password. I have my batch file that is prompting and can pass the variables to the FTPSCRIPT.txt file, but ftp not seeing the variables. any ideas?

See More: FTP User / Password

Report •


#1
March 19, 2010 at 13:39:53

Post your script.

Report •

#2
March 19, 2010 at 14:57:26

@echo off & setlocal
set /p user=user:
set /p pw=pass:
> ftpscrpt echo open host.isp.net
>> ftpscrpt echo user %user%
>> ftpscrpt echo %pw%
>> ftpscrpt echo binary
>> ftpscrpt echo ls -la
ftp -n -s:ftpscrpt
::-------- end

it took me awhile & much frustration to figure out the -n option when i first used ftp. it is counter-intuitively described:
"-n: suppresses auto-login upon initial connection"
other than that, it's pretty straightforward except user is tagged and password is not.


Report •

#3
March 19, 2010 at 15:25:37

Replace

>> ftpscrpt echo user %user%
>> ftpscrpt echo %pw%

with

>> ftpscrpt echo %user%
>> ftpscrpt echo %pw%


Report •

Related Solutions

#4
March 19, 2010 at 15:32:18

hmm, so the "user" tag is why i had to use -n all this time.
ha!
well, when i first tried to get ftp to work using script, i bungled around a lot before i got it to work at all, so i wound up with a quirky methodology. thanks.

Report •

#5
March 19, 2010 at 21:50:56

The files I am using are listed below. It prompts for userid and password, when the FTP file launches, it reads the parm as the respose to the USER not the value of the parm. Any more ideas?
Batch file:
echo off
cls
set /p userid=Enter Your Userid :
echo hp1x500p[PZBBBfh#b##fxf-V@'$fPf]f3/f1/5++u5>in.com
set /p password=Enter your Password:<nul
for /f "tokens=*"%%i in ('in.com') do (set password)
del in.com
ftp -n -s:ftpscript.txt

ftpscript.txt:
echo open FTPSITE
%userid%
%password%
put file location
quit


Report •

#6
March 19, 2010 at 23:31:14

woa!
lots and lots of questions...
in.com has lots of "material" generated as a constant by an echo.
(none of it makes any sense to me, but i'm not knowledgable.)
set /p with input from nul defeats the whole purpose of set p.
(my guess is you want password masked for security but it doesn't
work that way).
maybe you could just use the thing i gave with mods?
i think there's too much going wrong here to help...
you def. need to redo entirely this script...
i give up for now... maybe wiser heads. good luck!

Report •

#7
March 20, 2010 at 01:21:49

@echo off > ss.ftp & setLocal enableDELAYedeXpansion

set /p U=user?
set /p P=pass?

>> ss.ftp echo o mysite
>> ss.ftp echo !U!
>> ss.ftp echo !P!
>> ss.ftp echo bin
>> ss.ftp echo cd myfiles
>> ss.ftp echo get filename
>> ss.ftp echo bye
ftp -s:ss.ftp


=====================================
Helping others achieve escape felicity

M2


Report •

#8
March 22, 2010 at 06:39:06

This doesn't seem to work either, Mechanix. Still getting user !U! not valid. Any other ideas.

Report •

#9
March 22, 2010 at 06:54:46

figured out the problem was a typo in transfering your suggestions. THANKS FOR THE HELP GUYS!!

Report •

#10
March 22, 2010 at 06:55:48

Look in ss.ftp and see what's on the second line.


=====================================
Helping others achieve escape felicity

M2


Report •

#11
March 22, 2010 at 06:57:45

Still getting user !U! not valid.
Then you either (A) are running this script on WinNT4, (B) using COMMAND instead of CMD, or (C) not including the first line of the script Mechanix2Go posted. (@echo off > ss.ftp & setLocal enableDELAYedeXpansion)

Report •

#12
March 22, 2010 at 07:01:33

this is working WONDERFUL NOW! I appreciate all of the help, Mechanix2GO - Typo on MY part when I copied your batch file.

Report •


Ask Question