Opening multiple Notepad instances with specific files in Windows
Opening multiple Notepad instances with specific files simultaneously in Windows. Or, to put it another way: opening a number of text files at once with one click. Two variants:
Consistent file opening sequence
The opening order is made consistent. That is, the files will open exactly in the order they are listed in the list.
BAT file
@ECHO OFF
FOR %%G IN (
"C:\notepad\text1.txt"
"C:\notepad\text2.txt"
"C:\notepad\text3.txt"
) DO (
START "" "notepad.exe" %%G
:WAIT_LOOP
TASKLIST /FI "IMAGENAME eq notepad.exe" 2>NUL | FIND /I /N "notepad.exe">NUL
IF ERRORLEVEL 1 (
TIMEOUT /T 1>NUL
GOTO WAIT_LOOP
)
)
Basic file opening
The opening order is inconsistent and may vary with each run of the script. That is, sometimes the files will open right in the order they are listed in the list, and sometimes they will open in a random, unpredictable order.
BAT file
@ECHO OFF
START notepad "C:\notepad\text1.txt"
START notepad "C:\notepad\text2.txt"
START notepad "C:\notepad\text3.txt"
Directly in CMD
START notepad "C:\notepad\text1.txt" & START notepad "C:\notepad\text2.txt" & START notepad "C:\notepad\text3.txt"
Operating systems
- Windows