Close TXT file in batch

November 13, 2009 at 10:47:29
Specs: Windows XP

Is there a way to close a TXT file newly created so that it may be reread again?

Or should I make a 2nd batch file?


See More: Close TXT file in batch

Report •

November 13, 2009 at 13:56:34
Turn off computer
Turn on computer

Try doing some reading on terminating windows tasks. The pros will be able to help you further

Report •

November 13, 2009 at 14:04:10
I remember reading something on this forum about switching tasks. I tried to find it now and cant... sorry.

Report •

November 13, 2009 at 14:14:20
Try something like this:
taskkill /f /im notepad.exe

it closed my instance of notepad.exe

Report •

Related Solutions

November 13, 2009 at 15:25:30
What exactly do you mean by "close"? How was it created?
How is it currently "open"?

Report •

November 13, 2009 at 17:30:27
@OP, commands like more, type opens files internally and "closes" them as they finished reading them. If you want to reread them, execute the commands again. Otherwise, you if you want to do hardcore file manipulation where you can have complete control of where in the file you want to go, use a better programming language. eg Perl, Python.

GNU win32 packages | Gawk

Report •

November 13, 2009 at 17:46:17
Thanks ghostdog.

Report •

November 14, 2009 at 05:29:32
One other thing.

If you do this:

echo One more line>>file.txt

Then that opens the file, appends a line to it, and closes it. All
in one command. Even if you have that command in a loop, it
opens it, writes to it, and closes it, each time through the

The point is that the file is already closed by the time the next
command is executed. So you can do this without any

echo One more line>>file.txt
type file.txt

Report •

Ask Question