A way to edit Notepad files with Task Scheduler?


  1. Posts : 24
    Windows 7 64 Bit
       #1

    A way to edit Notepad files with Task Scheduler?


    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.

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


  2. Posts : 1,002
    XP Pro (x86) | 7 HP (x86) & (x64) | 7 Pro (x64)
       #2

    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


  3. Posts : 3
    Windows 7 Professional x64
       #3

    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


  4. Posts : 10,485
    W7 Pro SP1 64bit
       #4

    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.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 01:01.
Find Us