0

i wrote a script in cmd (*.cmd) that copy some file to ftp server, its working and its fine. this is the code:

@echo off
# put the command lines in to txt file
echo cd wf/721/pages >> temp.txt

echo put C:\Users\tc99670\Desktop\tempwf\721\pages\channel.json >> temp.txt
echo put C:\Users\tc99670\Desktop\tempwf\721\pages\main-screen.json >> temp.txt
echo put C:\Users\tc99670\Desktop\tempwf\721\pages\settings.json >> temp.txt
echo put C:\Users\tc99670\Desktop\tempwf\721\pages\wihow to usefi.json >> temp.txt



echo quit >> temp.txt
# connect to ftp and running the all the command in the txt file
ftp -n -s:temp.txt 150.42.40.221
# deleting the txt file
del temp.txt

its working great but when i tried to add the user input option its not working any more:

@echo off
set /P path=Enter path:




echo cd wf/721/pages >> temp.txt

echo put %path%\721\pages\channel.json >> temp.txt
echo put %path%\721\pages\main-screen.json >> temp.txt
echo put %path%\721\pages\settings.json >> temp.txt
echo put %path%\721\pages\wifi.json >> temp.txt



echo quit >> temp.txt

ftp -n -s:temp.txt 150.42.40.221

del temp.txt

i dont know what went wrong, thanks for your help :)

1 Answer 1

1

Do not use path as a variable name...

...it is a system variable that tells cmd where to look for programs. Change path in this script to something else, such as inputpath.

Sign up to request clarification or add additional context in comments.

1 Comment

If I could, I would make the first line of this answer larger, and bright red.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.