Solved

task scheduler windows 7

Posted on 2014-01-22
6
496 Views
Last Modified: 2014-01-27
I want to use task scheduler to display a log file once a day.
how do i set task scheduler to display just today's file.

the folder has a new log file with that days date on it
and keeps the old log files in the folder.
0
Comment
Question by:PAP0028
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 18

Expert Comment

by:Steven Harris
ID: 39801223
We may need some more information for this:

Are you checking by file name only, or just want the latest file in the folder?

How do you want to display it?  Are you using a specific program?
0
 
LVL 6

Accepted Solution

by:
Sasha Kranjac earned 500 total points
ID: 39801373
If the application is creating just one log file per day you can try this PowerShell script:

$DateToCompare = (Get-date).AddDays(-1)

$ItemToRun = Get-Childitem c:\new | where-object {$_.lastwritetime –gt $DateToCompare}

Invoke-Item c:\new\$ItemToRun

Replace c:\new with the path of the log files folder.

This script gets the current date, lists last created file and opens it with an associated program.
0
 

Author Comment

by:PAP0028
ID: 39810501
The program i am using Cobian Backup and its a txt log file.
 Cobian creates a new file once a day. I want the log file to open on the user display.
And yes I want the latest file to show in the folder
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 18

Expert Comment

by:Steven Harris
ID: 39810517
Did you try Sasa Kranjac's suggestion above?

First run the script to verify it works correctly in your scenario, then you can schedule the script to run via task scheduler.

For running PowerShell with Task Scheduler, try checking out the following EE Article.
0
 
LVL 6

Expert Comment

by:Sasha Kranjac
ID: 39811746
The PowerShell script I suggested opens any last created file in the specified folder and opens it with an associated program. In your case these are .TXT files and should be opened (usually) with Notepad, although many applications can read and display textual files.

Test the PowerShell script, modify the code to open the files on target computers and save the script in a file.

Then go to Start, then System and Security, open Administrative Tools. Double-click on Task Scheduler.

On the left pane, click on Task Scheduler Library. In the right pane, in the blank area below scheduled tasks, right-click and choose either Create Basic Task... or Create New Task...
Either way, when prompted for a Program/Script to schedule, point to your PowerShell script and fine-tune the scheduler to your needs.
Don't forget to test the script and the Task.

Check the Task by setting time of execution couple of minutes from the time you are creating the task so you don't have to wait until tomorrow to see if it works.
0
 

Author Closing Comment

by:PAP0028
ID: 39812997
Thanks for the fast answer.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many times while working on a computer regardless of any Operating System, lag and crashes seem to creep in, hindering your working speed. Sometimes, it can also cause your work to be lost unexpectedly and as a result, you are unable to meet your de…
The way I use Experts Exchange to assist me in analyzing and diagnosing a problem is I first enter a Verbose Question at Experts Exchange like: Office 2007 will hang when opening and saving files I then launch WordPad (any text editor will do) an…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question