Solved

Task Scheduler, VS.NET, Perforce Problem

Posted on 2006-11-24
10
417 Views
Last Modified: 2012-05-05
Hello,

I am having problems running an executable from Task Scheduler from one particular machine. The executable was created using VC++ and contains the code:

system( "p4 sync -f" );

Now the problem is when I execute from Task Scheduler, that line of code is skipped. If I run the executable in any other way it runs fine. That is, it runs fine when I double-click it, run it from the command line, run a batch file which calls that executable, etc etc. Only running from Task Scheduler I get problems. I need this executable to run at timed intervals without human intervention.

The weird thing is, I have the executable running fine from Task Scheduler on two other machines (same OS, same everything except hardware). I compared the VS properties in the working machines to that of the faulty machine and everything is the same.

What's going on here?

0
Comment
Question by:Raymun
10 Comments
 
LVL 4

Author Comment

by:Raymun
Comment Utility
Also, if I run

p4 sync -f

from the command line or batch it works.
0
 
LVL 4

Author Comment

by:Raymun
Comment Utility
Also something that might be of interest:

When the .exe is running in the working machines (regardless of whether its from double-clicking or Task Scheduler), the console is displayed. When running from the faulty machine, it isn't. The only way I know it's running is if I look in Task Manager or if I observe the changes that Perforce is making.
0
 
LVL 22

Expert Comment

by:cookre
Comment Utility
system() calls COMMAND.COM (CMD.EXE under NT) to execute the specified argument.  I suspect that, depending on OS, one, or both, is not being found.

Look at the default PATH, then in the indicated directories for those two programs.

If found, check for execution rights.
0
 
LVL 4

Author Comment

by:Raymun
Comment Utility
I'm able to call cmd.exe from the run prompt so I don't think that's the problem.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 8

Expert Comment

by:YoungBonzi
Comment Utility
Have the Task Scheduler call the batch file that works?? lol...
0
 
LVL 48

Expert Comment

by:AlexFM
Comment Utility
Maybe difference is in current directory?
0
 
LVL 4

Author Comment

by:Raymun
Comment Utility
OK I finally solved this problem. In order to make a change in Task Scheduler, you need to run the called app as some user with a password. I was running it as a user different from the currently logged in user. All I did was change the user to the logged in one and everything was magically fine. The code ran and the console showed while doing it. yay!

There are two pointers to this thread. Please delete them.
0
 
LVL 4

Author Comment

by:Raymun
Comment Utility
The problem was not a difference in current directory but rather the specified user to run as in Task Scheduler.
0
 

Accepted Solution

by:
CetusMOD earned 0 total points
Comment Utility
Closed, 500 points refunded.
CetusMOD
Community Support Moderator
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

744 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now