Simulate Enter in Bat.File

时间:2019-04-08 13:05:00

标签: batch-file

i´m writing my first batch-file (4 Parameters as Input which are used for FTP) and got a problem now.

I´m using the FTP command and then it has to type in the PARAM3 then Enter and then PARAM4.

I don´t know why it isn´t working. I already tried STRG+M in my Editor, but it´s not typing the word in the command prompt.

@echo off
@REM Sample batch file

SET PARAM1=""
SET PARAM2=""
SET PARAM3=""
SET PARAM4=""
SET PATH1=" "
rem SET /P PARAM1=Enter Hostdatei: %=%
rem SET /P PARAM2=Enter Zielname: %=%
rem SET /P PARAM3=Enter BENZL    : %=%
rem SET /P PARAM4=Enter Passwort    : %=%
SET PATH1=c:\Users\%PARAM3%

echo %PARAM1%
echo %PARAM2%
echo %PARAM3%
echo %PATH1%
cd %PATH1%
ftp adt0
timeout 5
%PARAM3%

%PARAM4%
pause > nul
@REM Process the params

1 个答案:

答案 0 :(得分:0)

That's not how it works: in a batchfile you don't do:

command
parameter1
parameter2
simulate_pressing_enter

But you do:

command parameter1 parameter2
(Pressing ENTER is simulated automatically)