user3165732
user3165732

Reputation: 23

Cmd doing weird things when i use ftp

Here i have my batch script

@echo on

if not [%1]==[] GOTO :copy_file
if [%1]==[] GOTO :open_folder

:copy_file
echo open 95.105.195.45 > temp.txt

echo nope >> temp.txt
echo nope >> temp.txt
echo nope >> temp.txt
echo nope >> temp.txt
echo nope >> temp.txt
echo nope >> temp.txt
echo nope >> temp.txt
echo nope >> temp.txt
echo nope >> temp.txt
echo nope >> temp.txt
echo nope >> temp.txt

echo user bukvicak pk3027fr >> temp.txt

echo put %1 >> temp.txt

echo quit >> temp.txt

ftp -s:temp.txt

del temp.txt
del %1
GOTO :end


:open_folder
%SystemRoot%\explorer.exe "C:\Users\Igor\AppData\Roaming\Microsoft\Windows\Network Shortcuts\95.105.195.45"
GOTO :end

:end
exit

At todays morning the script runned fine and now when i start it it will begin this loop after executing the "ftp -s:temp.txt"

enter image description here

It is script for automated drag and drop moving files to ftp server. Now when i use ftp command in any other script it will start the loop from the screenshot. But when i copy the script to another PC, it works fine. Or when i start it trough CMD it works fine too.

Sorry for my bad English

Can somebody help me? Thank you very much

Upvotes: 0

Views: 78

Answers (1)

MC ND
MC ND

Reputation: 70933

Your batch file is named ftp.bat or ftp.cmd and when it reaches the line ftp -s:temp.txt it is calling itself

Rename the batch file to something else or use ftp.exe -s:temp.txt

Upvotes: 1

Related Questions