Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Console App - Scheduled Task - Text File

Console App - Scheduled Task - Text File

Scheduled Pinned Locked Moved C#
question
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 9123917
    wrote on last edited by
    #1

    I have created a console app where it will finally create a text file. Everything run well when I run the program manually but not when I used scheduled task to run it. Anyone know the reason?

    Richard Andrew x64R D 3 Replies Last reply
    0
    • U User 9123917

      I have created a console app where it will finally create a text file. Everything run well when I run the program manually but not when I used scheduled task to run it. Anyone know the reason?

      Richard Andrew x64R Offline
      Richard Andrew x64R Offline
      Richard Andrew x64
      wrote on last edited by
      #2

      You haven't described what goes wrong, so how can anybody guess what could be the cause? Have you run the program in the debugger?

      The difficult we do right away... ...the impossible takes slightly longer.

      U 1 Reply Last reply
      0
      • Richard Andrew x64R Richard Andrew x64

        You haven't described what goes wrong, so how can anybody guess what could be the cause? Have you run the program in the debugger?

        The difficult we do right away... ...the impossible takes slightly longer.

        U Offline
        U Offline
        User 9123917
        wrote on last edited by
        #3

        When run with scheduled task, .exe run properly but it doesn't create text file as writen in codes. It run well and a text file create when I run it manually.

        Richard Andrew x64R L 2 Replies Last reply
        0
        • U User 9123917

          When run with scheduled task, .exe run properly but it doesn't create text file as writen in codes. It run well and a text file create when I run it manually.

          Richard Andrew x64R Offline
          Richard Andrew x64R Offline
          Richard Andrew x64
          wrote on last edited by
          #4

          Maybe it is a permissions issue. Is the scheduled task running as the same user as when run manually? Have you attached a debugger to it when it's run as a scheduled task?

          The difficult we do right away... ...the impossible takes slightly longer.

          1 Reply Last reply
          0
          • U User 9123917

            When run with scheduled task, .exe run properly but it doesn't create text file as writen in codes. It run well and a text file create when I run it manually.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            You DO have an exception-handler that catches and logs unhandled exceptions?

            Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

            L 1 Reply Last reply
            0
            • L Lost User

              You DO have an exception-handler that catches and logs unhandled exceptions?

              Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Eddy Vluggen wrote:

              You DO have an exception-handler

              :laugh: That's certainly funnier than the so-called jokes in the Soapbox.

              One of these days I'm going to think of a really clever signature.

              1 Reply Last reply
              0
              • U User 9123917

                I have created a console app where it will finally create a text file. Everything run well when I run the program manually but not when I used scheduled task to run it. Anyone know the reason?

                D Offline
                D Offline
                dybs
                wrote on last edited by
                #7

                Does the task scheduler display an error code next to the task when it runs? Also, check the Application event log around that time and see if there are any errors (although as Eddy mentioned, it's a very good idea to catch any exceptions and log them for later debugging - but the Event Viewer might display the exception as well).

                The shout of progress is not "Eureka!" it's "Strange... that's not what i expected". - peterchen

                1 Reply Last reply
                0
                • U User 9123917

                  I have created a console app where it will finally create a text file. Everything run well when I run the program manually but not when I used scheduled task to run it. Anyone know the reason?

                  D Offline
                  D Offline
                  dybs
                  wrote on last edited by
                  #8

                  Also make sure nothing else has the text file open when the scheduled task runs.

                  The shout of progress is not "Eureka!" it's "Strange... that's not what i expected". - peterchen

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups