How to wait for file to close in batch file than proceed for execution

Pritish Jain

I have following batch script which opens a file and wait for process to close than read from the file

@ECHO OFF

call file.txt
:wait
tasklist /M notepad++.exe > nul && goto wait
FOR /F %%i IN (file.txt) DO @echo %%i
PAUSE

but it is stuck at the loop itself can someone please suggest what is wrong with it?

Loïc MICHEL

please try

call file.txt

:wait
tasklist /fi "imagename eq notepad++.exe" |findstr "notepad++.exe"
if "%errorlevel%"=="0" goto wait
FOR /F %%i IN (file.txt) DO @echo %%i
PAUSE

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

close batch file after execution in java

From Dev

How Close task in batch file

From Dev

How to close cmd in batch file

From Dev

Close command prompt window after batch file execution

From Dev

How to wait until my batch file is finished

From Dev

How to make a batch file wait for fractions of a second?

From Dev

how to make a batch file close automatically

From Dev

Wait for file removal after close

From Dev

batch - how can I close a batch file that was started from another batch file

From Dev

Batch file wait for entered command

From Dev

Batch file - wait for another commands

From Dev

Windows Batch file execution error

From Dev

How to wait before file stream is done writing before I close it?

From Dev

How to write the "greater than symbol" in a HTML file using a batch file

From Dev

Convert .sh file to a batch file for execution in windows

From Dev

How do I make a batch file wait / sleep for some seconds?

From Java

How to prevent auto-closing of console after the execution of batch file

From Dev

How to write a batch file to open applications and close them if they are already open

From Dev

How to Open and Close Internet Explorer from batch file?

From Dev

How to close batch file if one line writes multiple lines?

From Dev

How to pass more than 9 parameters to batch file

From Dev

How to trigger a batch file in Jenkins without waiting for batch execution results and status

From Dev

How to wait on file creation

From Dev

wait for process to end in windows batch file

From Dev

Composer exit batch file after finish execution

From Dev

C# batch file execution never exits

From Dev

Fire batch (.bat) file execution and continue

From Dev

Stop execution of batch file on error for sqlplus in oracle

From Dev

Getting input data after execution of batch file

Related Related

  1. 1

    close batch file after execution in java

  2. 2

    How Close task in batch file

  3. 3

    How to close cmd in batch file

  4. 4

    Close command prompt window after batch file execution

  5. 5

    How to wait until my batch file is finished

  6. 6

    How to make a batch file wait for fractions of a second?

  7. 7

    how to make a batch file close automatically

  8. 8

    Wait for file removal after close

  9. 9

    batch - how can I close a batch file that was started from another batch file

  10. 10

    Batch file wait for entered command

  11. 11

    Batch file - wait for another commands

  12. 12

    Windows Batch file execution error

  13. 13

    How to wait before file stream is done writing before I close it?

  14. 14

    How to write the "greater than symbol" in a HTML file using a batch file

  15. 15

    Convert .sh file to a batch file for execution in windows

  16. 16

    How do I make a batch file wait / sleep for some seconds?

  17. 17

    How to prevent auto-closing of console after the execution of batch file

  18. 18

    How to write a batch file to open applications and close them if they are already open

  19. 19

    How to Open and Close Internet Explorer from batch file?

  20. 20

    How to close batch file if one line writes multiple lines?

  21. 21

    How to pass more than 9 parameters to batch file

  22. 22

    How to trigger a batch file in Jenkins without waiting for batch execution results and status

  23. 23

    How to wait on file creation

  24. 24

    wait for process to end in windows batch file

  25. 25

    Composer exit batch file after finish execution

  26. 26

    C# batch file execution never exits

  27. 27

    Fire batch (.bat) file execution and continue

  28. 28

    Stop execution of batch file on error for sqlplus in oracle

  29. 29

    Getting input data after execution of batch file

HotTag

Archive