JSI Tip 4731. How do I open multiple files that match a search string in notepad?

Jerold Schulman

January 23, 2002

1 Min Read
ITPro Today logo in a gray background | ITPro Today


I have scripted Multipad.bat to open from one to n instances of notepad based on a standard search string.

The syntax for using multipad.bat is:

multipad

Examples:

multipad abc*.txt

Opens all .txt file in the current directory that start with abc.

multipad *.txt

Opens all .txt file in the current directory

multipad folderxyz?abc.*    

Opens all files in the folder directory that have xyz as the first 3 characters,anything for the fourth character, abc for the 5th, 6th, and 7th character, with any extension.

Multipad.bat contains:

@echo offsetlocalif {%1}=={} goto syntaxset file=%1set dp=%~dp1pushd %dp%for /f "Tokens=*" %%i in ('DIR %file% /b /a-d') do call :openit "%%i"popdendlocalgoto :EOF:syntax @echo multipad searchstringendlocalgoto :EOF:openitstart notepad.exe %1



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like