save text file with batch file

October 18, 2011 at 20:31:08
Specs: Windows Vista

hi I'm trying to save a text document by using a batch file. You see i know how to open the text file with the batch file its getting it to save & close the text file I'm having trouble with. If any body knows how to do this your help would be very appreciated

See More: save text file with batch file

Report •


#1
October 18, 2011 at 20:37:09

You could use

taskkill /im notepad.exe

to close it, but that won't save it.

Have you tried just writing directly to a text file like this?

@echo off

echo Hello World > textfile.txt


Report •

#2
October 19, 2011 at 06:13:49

yeah i just tried that and it does not help.
sorry i didn't say this before but i also typed .LOG in to the notpad.
i want the batch file to just open,save,& close.

Report •

#3
October 19, 2011 at 08:55:32

Hi lightdark159,

Can you explain more about what it is you are trying to do? I'm confident I can help you, I just don't know what the overall goal is.


Report •

Related Solutions

#4
October 20, 2011 at 06:37:58

i found out that if you type .LOG in to notepad it will write the date and time the next time the file is opened. and i want to write a batch file that will open that text file save the text and close the file. so i can put that in the start up folder. but i dont know what command will do that. i have tried searching it and all i have found was how to make a batch file.

Report •

#5
October 20, 2011 at 07:51:02

Seems like you're trying to implement Logon Auditing, only insecurely.

How To Ask Questions The Smart Way


Report •

#6
October 20, 2011 at 20:13:58

what exactly is that?

Report •

#7
October 21, 2011 at 05:20:21

Logon auditing, as the link provided in my previous post explains, keeps a log of when an account is logged in. It stores this information in the Security Event Log, and is provided by the kernel. Because of this, you need to be an Administrator to view the log, or to change it, something your log cannot do. Someone could notice your notepad logging, open the file in question, and delete everything out of it. If you remove the user's ability to edit the log file, you remove that user's ability to be logged by your method. So Logon auditing is preferred.

How To Ask Questions The Smart Way


Report •

#8
October 21, 2011 at 06:49:35

oh ok. i was reading and i didnt under stand. thanks for all your help

Report •


Ask Question