alternative to system function 
Author Message
 alternative to system function

I have a problem with using system to run a batch file on Windows NT via a
scheduler. I have tried the following:

# attempt 1
chdir($whatever)
system("copyBIN.bat");

# attempt 2
chdir($whatever)
system("CMD /Q /C copyBIN.bat");

# attempt 3
chdir($whatever)
system("xcopy", $src, $dest, $param);

In all cases the perl script runs fine from a DOS Prompt but does not if I
schedule it. I have tried a few schedulers and they all fail the same way. I
have also tried using Win32::Process to create a process; same thing.

It is obviously a problem with Windows NT and the scheduler. I was thinking
that the scheduler might not like output to STDOUT or it creates a process
different. I'm not exactly sure. I know if I use C and the system command I get
the same problem.

What I am trying to figure out is if there is some other way to get this to
work. The batch file is being used by developers to copy binaries needed for
their type libraries. I need some sort of solution that I can use and the
developers can use. They like a batch file that they can just double click. I
need something from perl that will let me get around whatever is wrong.

If I could figure out what was going wrong I might be able to come up with my
own solution. Does anyone know how perl implements its system call on Windows
NT? Is there any other alternative to running a batch file then system or
Win32::Process?

Any help would be greatly appreciated.

Darrell Grainger



Mon, 13 Oct 2003 00:29:32 GMT  
 alternative to system function
[Posted and mailed]



Quote:
>It is obviously a problem with Windows NT and the scheduler.

Uh-huh...

Quote:
>I know if I use C and the system command I get the same problem.

Here's your clue!  You know it's not perl, and you're (probably
correctly) blaming something else.  

Oh, you've come so far to almost find the problem and just gave up!  
Here's your next few steps in diagnostics:

* Can you run _anything_ with system()?    (In C or Perl?)
* Are you having problems with things that just affect the filesystem?
* Could it be a permissions problem?  (You know, when you're at a DOS
  prompt you may not be the same user as the user-id who's running the
  scheduler...)
  Maybe you can't read a file.  Maybe you can't see a directory.
* Is it a pathname problem?  Are you not where you think you are?
  I noticed that you're doing a chdir, but not making sure it worked.
  chdir() _can_ fail.  For a variety of reasons.  That's why it has a
  return value.
* Tried explicitly (full-pathname) naming the thing you want to run?  
  To copy?

--
    Clinton A. Pierce              Teach Yourself Perl in 24 Hours  *and*

"If you rush a Miracle Man,     for details, see http://geeksalad.org    
        you get rotten Miracles." --Miracle Max, The Princess Bride



Mon, 13 Oct 2003 08:27:40 GMT  
 alternative to system function
A few people gave me suggests and I finally figure out what the problem was. It
is an OS problem that perl cannot get around (network file permissions).

Thanks to everyone who helped me out.

This thread is dead... I'm moving it to a Windows NT newsgroup since there is
no way perl can get around this problem.

Quote:

> I have a problem with using system to run a batch file on Windows NT via a
> scheduler.



Tue, 14 Oct 2003 01:08:01 GMT  
 alternative to system function
If you can run this batch file by typing its name in at the command prompt
you might have the problem I had: when on a Windows NT 4.0 Backup Domain
Controller one must set "can run as batch file" or some such nonsense
(because it has been a while) for the account the Scheduler uses. Let me
know.

CharlieB



Tue, 14 Oct 2003 08:04:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. 2 Bookmarks point to same row?

2. Help Needed.

3. Why are pattern alternatives slower than logical alternatives?

4. Using Built-in Perl Functions verses System Functions

5. Using the system function

6. system function calls in DOS perl??

7. problem with "system" function

8. How to print output of system() function to HTML

9. Problem with the win32 system() function

10. Perl functions vs. unix system calls

11. How to use system function perl

12. System Function Question

 

 
Powered by phpBB® Forum Software