Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, In my perl scripts, I called system("mycmd > output"). The perl script is called from a windows service. When the service is running under LocalSystem, the system() call failed, and $! shows "no such file or directory error". If I remove the redirection, it works. If I changed the service to use Domain\User, I don't see the problem. And on Win2k Professional, I don't see the problem. It only happens on Win2k Server. Any help? Thanks George

Replies are listed 'Best First'.
Re: redirection issue on Win2k Server
by Roger (Parson) on Feb 11, 2004 at 00:02 UTC
    Is the output file your are trying to redirect to on a network drive? A Windows service does not have permission/privileges to access a network file, or access a network drive.

      No. It is directed to local disk c: on a FAT32 filesystem. I am wondering that if service under LocalSystem can not replace the STDOUT for the program to be launched.
Re: redirection issue on Win2k Server
by NetWallah (Canon) on Feb 11, 2004 at 01:56 UTC
    Is it possible that the LocalSystem account is not inheriting the PATH variable, and not finding the program ?
    Have you tried it with a fully qualified path to "mycmd" ?
    To get a feel for what the environment is, change your code to run "cmd /k" without redirection. Also, you need to setup your service to "allow interaction with the desktop". Then you can see what rights are available to the command prompt.

    "When you are faced with a dilemma, might as well make dilemmanade. "