A way to edit Notepad files with Task Scheduler?

MouseFollower

New member
Local time
8:46 PM
Messages
24
I need a way to change a Notepad file with Task Scheduler, or anyway really.
Heres an example:

I edit a Notepad file, and save it.
At 1 PM I want the Notepad file to automatically change to what I want.
So when I open that Notepad file after 1 PM, it looks the same as it did before I edited anything.

Wondering if this is possible. I heard somewhere it was, but couldn't figure out how.

I need to use this on the Host file, by the way. :devil:

Is there a batch file or something that I can schedule to run with Task Scheduler to do this?
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 64 Bit
Hi MouseFollower :)

Notepad can open a lot of file types ... I presume you mean a TXT file ?

I have never used TaskScheduler ... BUT

Lets call the Notepad file Daily.txt

Two script files
Start.vbs
  • condition to handle missing "Daily.txt"
  • condition comparing dates(?) (or file attributes) to avoid clearing Daily.txt before 1300hrs, if OS is rebooted before 1300hrs
  • copy contents of "Daily,txt" to a "Hold.tmp" file (overwrite "Hold.tmp")

OneOclock.vbs
  • overwrite "Daily.txt" with contents of "Hold.tmp"

Run "Start.vbs" at OS startup (or via Task Scheduler at a specific time)
Run "OneOclock.vbs" via Task Scheduler at 1:00pm

VBScript Forum is a good forum for script help
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Toshiba, Lenovo (laptops) + 4 rigs
OS
XP Pro (x86) | 7 HP (x86) & (x64) | 7 Pro (x64)
The simplest way is to create a .bat file and a text file with the desired text:

Code:
copy C:\PATH\TO\source.txt C:\PATH\TO\destination.txt

Where source.txt is the fle to copy the text from and destination.txt is the file to copy the text to.
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 Professional x64
Without violating the forum rules...
13) No ad blocking discussions. This site depends on ads to pay for the costs of running and maintaining it
...can you tell us more about the changes that you want to have take place in the HOSTS file? What are you attempting to accomplish?

diolemo might have given you the simplest solution, but you will probably want two source files. And the HOSTS file is in a protected folder... so you may need to run the scheduled task with the option named Run with highest privileges checked.

Let's not call the HOSTS file a "Notepad file", let's stick to calling it the HOSTS file.http://www.sevenforums.com/members/diolemo.html
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
Back
Top