0
votes

Consider this batch file :
@echo off set /p var1=Input your first name and press Enter key : set /p var2=Input your last name and press Enter key : pause
If I run this batch file by double clicking on it, it works fine.
But if it is run through console window of NppExec plugin of Notepad++, it only waits for first input.
Probably, "enter" key pressed by user is taken as input for second "set" command.

One solution may be to insert one more "set" command before second "set" as:
@echo off set /p var1=Input your first name and press Enter key : set /p temp= set /p var2=Input your last name and press Enter key : pause
But then problem will arise, when this batch file wiil be run through command prompt or simply by double clicking on it (will wait for three inputs). Is there any way to solve this?

1
Have you tried it without the indent. - 09stephenb
How do you run this batch file? Maybe you need to wrap it to real cmd-command: cmd /c yourbatchfile.cmd. - user694733
@user694733 I run this batch file as : In console of NppExec, go to batch file directory and type batchfile.cmd I tried cmd /c batchfile.cmd, I also used cmd /c before "set" command(s) in my batch file. Nothing worked. - San
@09stephenb Yes, actually I tried without indent. - San

1 Answers

1
votes

See if this changes the behaviour by adding a delay

@echo off 
set /p "var1=Input your first name and press Enter key: "
for /L %%a in (1,1,500000) do rem
set /p "var2=Input your last name and press Enter key: "
pause