Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Advanced scheduled task
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Advanced scheduled task

 Post Reply Post Reply Page  12>
Author
huwnet View Drop Down
Senior Member
Senior Member


Joined: 30 May 2003
Location: England
Status: Offline
Points: 1375
Post Options Post Options   Thanks (0) Thanks(0)   Quote huwnet Quote  Post ReplyReply Direct Link To This Post Topic: Advanced scheduled task
    Posted: 13 December 2004 at 3:06pm
I need to be able to run a certain program at logon depending on the day either via batch script or scheduled tasks. However scheduled tasks is not advanced enough to do a specific day AND to run at logon. How would I create a batch script to do this? Confused

Edited by huwnet - 16 January 2005 at 12:58pm
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 13 December 2004 at 3:10pm
For that I would write my own program in VB.NET or C#.NET
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 13 December 2004 at 3:20pm
Something like


Imports System.Diagnostics

Module TaskRunner

    Sub Main()
        Select Case Now.DayOfWeek
         Case DayOfWeek.Friday
         Process.Start("myApplication.exe", "myparameter")
         Case DayOfWeek.Monday
         Process.Start("Monday.exe")
         Case DayOfWeek.Saturday
         Process.Start("Saturday.exe")
         Case DayOfWeek.Sunday
         'etc.
         Case DayOfWeek.Thursday
         'etc.
         Case DayOfWeek.Tuesday
         'etc.
         Case DayOfWeek.Wednesday
         'etc.
        End Select
    End Sub

End Module


Then save that as TaskRunner.vb and go into command prompt then type:

%SystemRoot%\Microsoft.NET\Framework\v1.1.4322\vbc.exe /t:exe /r:System.dll /r:Microsoft.VisualBasic.dll /out:C:\TaskRunner.exe C:\TaskRunner.vb

replacing the relevant paths


Edited by Mart - 13 December 2004 at 3:21pm
Back to Top
huwnet View Drop Down
Senior Member
Senior Member


Joined: 30 May 2003
Location: England
Status: Offline
Points: 1375
Post Options Post Options   Thanks (0) Thanks(0)   Quote huwnet Quote  Post ReplyReply Direct Link To This Post Posted: 13 December 2004 at 3:20pm
Thanks I will try it out
Big smile
Back to Top
huwnet View Drop Down
Senior Member
Senior Member


Joined: 30 May 2003
Location: England
Status: Offline
Points: 1375
Post Options Post Options   Thanks (0) Thanks(0)   Quote huwnet Quote  Post ReplyReply Direct Link To This Post Posted: 13 December 2004 at 3:26pm
error Ouch:

C:\taskrunner.vb(6) : error BC30451: Name 'Now' is not declared.
Back to Top
huwnet View Drop Down
Senior Member
Senior Member


Joined: 30 May 2003
Location: England
Status: Offline
Points: 1375
Post Options Post Options   Thanks (0) Thanks(0)   Quote huwnet Quote  Post ReplyReply Direct Link To This Post Posted: 13 December 2004 at 3:27pm
full log:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Administrator>cd C:\windows

C:\WINDOWS>cd microsoft.net

C:\WINDOWS\Microsoft.NET>cd framework

C:\WINDOWS\Microsoft.NET\Framework>dir
 Volume in drive C has no label.
 Volume Serial Number is A0D8-4478

 Directory of C:\WINDOWS\Microsoft.NET\Framework

11/11/2004  19:14    <DIR>        & nbsp; .
11/11/2004  19:14    <DIR>        & nbsp; ..
20/02/2003  19:09         & nbsp;  57,344 NETFXSBS10.exe
20/02/2003  18:44         & nbsp;  36,354 NETFXSBS10.hkf
20/02/2003  19:09         & nbsp;   5,120 sbscmp10.dll
14/05/2002  09:42         & nbsp;   5,120 sbs_diasymreader.dll
14/05/2002  09:42         & nbsp;   5,120 sbs_iehost.dll
14/05/2002  09:42         & nbsp;   5,120 sbs_microsoft.jscript.dll
14/05/2002  09:42         & nbsp;   5,632 sbs_microsoft.vsa.vb.codedomprocessor.dll
14/05/2002  09:42         & nbsp;   5,120 sbs_mscordbi.dll
19/07/2002  11:52         & nbsp;   5,120 sbs_mscorrc.dll
14/05/2002  09:42         & nbsp;   5,120 sbs_mscorsec.dll
14/05/2002  09:42         & nbsp;   5,120 sbs_system.configuration.install.dll
14/05/2002  09:42         & nbsp;   5,120 sbs_system.data.dll
14/05/2002  09:42         & nbsp;   5,120 sbs_system.enterpriseservices.dll
27/06/2002  12:45         & nbsp;   5,120 sbs_VsaVb7rt.dll
14/05/2002  09:42         & nbsp;   5,120 sbs_wminet_utils.dll
22/03/2004  21:19    <DIR>        & nbsp; v1.0.3705
11/11/2004  19:29    <DIR>        & nbsp; v1.1.4322
         &nbs p;    15 File(s)        160,770 bytes
         &nbs p;     4 Dir(s)  30,362,521,600 bytes free

C:\WINDOWS\Microsoft.NET\Framework>cd v1.1.4322

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322>vbc /t:exe /r:System.dll /r:Microso
ft.VisualBasic.dll /out:C:\taskrunner.exe C:\taskrunner.vb
Microsoft (R) Visual Basic .NET Compiler version 7.10.6001.4
for Microsoft (R) .NET Framework version 1.1.4322.2032
Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.

C:\taskrunner.vb(6) : error BC30451: Name 'Now' is not declared.

        Select Case Now.DayOfWeek
         &nbs p;          ~~~
C:\taskrunner.vb(7) : error BC30058: Statements and labels are not valid between
 'Select Case' and first 'Case'.

         &nbs p;  Case DayOfWeek.Friday
         ~
C:\taskrunner.vb(8) : error BC30058: Statements and labels are not valid between
 'Select Case' and first 'Case'.

         &nbs p;      Process.Start("Saturday.exe")
         ~
C:\taskrunner.vb(9) : error BC30058: Statements and labels are not valid between
 'Select Case' and first 'Case'.

         &nbs p;  Case DayOfWeek.Monday
         ~
C:\taskrunner.vb(10) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;      Process.Start("C:\Program Files\Mozilla Firefox\firefox.ex
e", "")
         ~

C:\taskrunner.vb(11) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;  Case DayOfWeek.Saturday
         ~
C:\taskrunner.vb(12) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;      Process.Start("Saturday.exe")
         ~
C:\taskrunner.vb(13) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;  Case DayOfWeek.Sunday
         ~
C:\taskrunner.vb(14) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;      Process.Start("Saturday.exe")
         ~
C:\taskrunner.vb(15) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;  Case DayOfWeek.Thursday
         ~
C:\taskrunner.vb(16) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;      Process.Start("Saturday.exe")
         ~
C:\taskrunner.vb(17) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;  Case DayOfWeek.Tuesday
         ~
C:\taskrunner.vb(18) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;      Process.Start("Saturday.exe")
         ~
C:\taskrunner.vb(19) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;  Case DayOfWeek.Wednesday
         ~
C:\taskrunner.vb(20) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 13 December 2004 at 3:42pm
Add

Imports Microsoft.VisualBasic

after the Imports System
Back to Top
huwnet View Drop Down
Senior Member
Senior Member


Joined: 30 May 2003
Location: England
Status: Offline
Points: 1375
Post Options Post Options   Thanks (0) Thanks(0)   Quote huwnet Quote  Post ReplyReply Direct Link To This Post Posted: 13 December 2004 at 3:51pm
Ouch

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Administrator>cd C:\microsoft.net\framework\v1.1.4322
The system cannot find the path specified.

C:\Documents and Settings\Administrator>cd C:\microsoft.net
The system cannot find the path specified.

C:\Documents and Settings\Administrator>C:\
'C:\' is not recognized as an internal or external command,
operable program or batch file.

C:\Documents and Settings\Administrator>cd C:\

C:\>cd microsoft.net
The system cannot find the path specified.

C:\>cd C:\windows\microsoft.net\framework\v1.1.4322

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322>vbc.exe /t:exe /r:system.dll /r:Mic
rosoft.VisualBasic.dll /out:C:\Taskrunner.exe C:\taskrunner.vb
Microsoft (R) Visual Basic .NET Compiler version 7.10.6001.4
for Microsoft (R) .NET Framework version 1.1.4322.2032
Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.

C:\taskrunner.vb(7) : error BC30058: Statements and labels are not valid between
 'Select Case' and first 'Case'.

         &nbs p;  Case DayOfWeek.Friday
         ~
C:\taskrunner.vb(8) : error BC30058: Statements and labels are not valid between
 'Select Case' and first 'Case'.

         &nbs p;      Process.Start("Saturday.exe")
         ~
C:\taskrunner.vb(9) : error BC30058: Statements and labels are not valid between
 'Select Case' and first 'Case'.

         &nbs p;  Case DayOfWeek.Monday
         ~
C:\taskrunner.vb(10) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;      Process.Start("C:\Program Files\Mozilla Firefox\firefox.ex
e", "")
         ~

C:\taskrunner.vb(11) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;  Case DayOfWeek.Saturday
         ~
C:\taskrunner.vb(12) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;      Process.Start("Saturday.exe")
         ~
C:\taskrunner.vb(13) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;  Case DayOfWeek.Sunday
         ~
C:\taskrunner.vb(14) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;      Process.Start("Saturday.exe")
         ~
C:\taskrunner.vb(15) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;  Case DayOfWeek.Thursday
         ~
C:\taskrunner.vb(16) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;      Process.Start("Saturday.exe")
         ~
C:\taskrunner.vb(17) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;  Case DayOfWeek.Tuesday
         ~
C:\taskrunner.vb(18) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;      Process.Start("Saturday.exe")
         ~
C:\taskrunner.vb(19) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;  Case DayOfWeek.Wednesday
         ~
C:\taskrunner.vb(20) : error BC30058: Statements and labels are not valid betwee
n 'Select Case' and first 'Case'.

         &nbs p;      Process.Start("Saturday.exe")
         ~

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322>
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.