-3

I have batch file which I want to execute, during execution it asks for user input twice to press enter key. I want to skip this completely either by simulating the enter key press or by somehow completely overcoming it.

Edit : I can't edit the bat file to skip the program asking for user input

I have tried echo | <yourfinecommandhere> but this just simulates one enter key press. I am unable to simulate multiple enter key press

phuclv
  • 37,963
  • 15
  • 156
  • 475

1 Answers1

1

In cmd simply group multiple echos. For example this will print 2 newlines to the pipe

(echo[& echo[) | command

echo( is the most reliable way to print a new line in cmd, but in this case echo[ is probably better. Space is significant here so there must be no space after [


In PowerShell it's easier. For example to print 3 newlines use

"`n`n`n" | command

Actually the above will print 4 new lines, because there's an implicit new line after the string. But that won't affect the output. If you want exactly 3 new lines then use

 Write-Output -NoNewline "`n`n`n" | command
phuclv
  • 37,963
  • 15
  • 156
  • 475