0

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?

san
  • 126
  • 4
  • 11
  • Have you tried it without the indent. – 09stephenb Apr 11 '14 at 10:20
  • How do you run this batch file? Maybe you need to wrap it to real `cmd`-command: `cmd /c yourbatchfile.cmd`. – user694733 Apr 11 '14 at 11:04
  • @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 Apr 11 '14 at 14:04
  • @09stephenb Yes, actually I tried without indent. – san Apr 11 '14 at 14:08

1 Answers1

1

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
foxidrive
  • 40,353
  • 10
  • 53
  • 68
  • No, Still not waiting for second input. Here is the result of console window of NppExec : _Input your first name and press Enter key: FirstInput Input your last name and press Enter key: Press any key to continue . . ._ – san Apr 11 '14 at 13:50