Not sure whether it's relevant here but here goes...
I want to open multiple text files in a folder using Notepad, all at the same time. Using command line window
Start ->Run -> Cmd
cd C:\Test
for %X in (*.txt) do notepad %X
will enable all the files open on top of one another.
I want to create a batch file to automate this process but by doing :
cmd
for %%X in ("C:\Test\"*.txt) do notepad %%X
will only open the first file File1.txt. After closing File1.txt, then only the second file File2.txt will open and so on.
Is there a way for me to automate this process using batch file or any other programming language that'll be more suitable e.g. VB, Perl, C/C++, etc.
Need your input and suggestions as still new to programming. Thanks.
Using batch file to open multiple text files using Notepad simultaneously
|
Go4Expert Member
|
|
| 2Jul2009,14:19 | #1 |
|
~ Б0ЯИ Τ0 С0δЭ ~
|
![]() |
| 2Jul2009,17:01 | #2 |
|
Hi and welcome to G4EF
![]() So, you want all txt files to be open simultaneously, right ? This is an easy task and can be done in any language. But I will prefer VBScript as you need not compile it and you can directly run it like a batch file. ![]() Code: VB
![]() The code is quite self explanatory, so you won't have difficulty understanding it. If you need to change the target folder, change the variable MyFolder. |
|
Go4Expert Member
|
|
| 3Jul2009,07:38 | #3 |
|
Thanks for the welcome. You've got exactly what I need!!!
Thanks again.
|
|
~ Б0ЯИ Τ0 С0δЭ ~
|
![]() |
| 3Jul2009,12:08 | #4 |
|
My pleasure !
|
|
Light Poster
|
|
| 20Aug2009,19:34 | #5 |
|
Nice solution. Nice forum. Here is an alternate script to open all .txt files in C:\Test one by one with notepad.
Code:
# Script txtfiles.txt
cd "C:\Test" ; var str list ; lf -n "*.txt" > $list
while ($list <> "")
do
var str file ; lex "1" $list > $file ; system ("\""+$file+"\"")
done
lf -rn "*.txt" Find files recursively in subfolders and subsubfolders. lf -rn "*.txt" "C:\folder" Find files in C:\folder". lf -rn "*.txt" "C:\folder" ($fsize > 5000) Find files whose size is greater than 5000 bytes. lf -rn "*.txt" "C:\folder" ( ($fsize > 5000) AND ($fctime > "20090101") ) Find files whose size is greater than 5000 bytes AND whose creation time is after Jan 1, 2009. etc. Randi
SaswatPadhi
like this
|
|
Go4Expert Member
|
|
| 21Aug2009,05:32 | #6 |
|
Wow.. nice... thanks..
Btw, that looks like Perl scripting isit? |
|
~ Б0ЯИ Τ0 С0δЭ ~
|
![]() |
| 21Aug2009,06:06 | #7 |
|
That's bitterScripting, as he mentioned.
|
|
Banned
|
|
| 21Aug2009,08:31 | #8 |
|
Nice code SP
in VB....I would like to implement same in .NET
|
|
Go4Expert Member
|
|
| 4Oct2009,07:19 | #9 |
|
i tried this vbs file to open multiple text files and get programming error on line 7 character 6 expected '='
what does this mean |
|
~ Б0ЯИ Τ0 С0δЭ ~
|
![]() |
| 4Oct2009,18:50 | #10 |



in VB....I would like to implement same in .NET 