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

I am familiar with accessing system commands via the ` ` symbols. I am wondering if I can write a script that can access the Windows System Command to work with files via a script that is operating off of Apache on a Linux Box? i.e. a user enters in data in fields and the Perl script modifies and copies files on that machine they are working on via the Perl script by the script accessing the DOS prompt and copying and modifying files and such...Just a thought I had for a neat program I wanted to create.. Another thing I do not want to have to install Active Perl on every end user machine to pull this off if at all possible...

Replies are listed 'Best First'.
Re: Access DOS System Commands
by tilly (Archbishop) on Jun 26, 2003 at 20:07 UTC
    A trick for installing Active Perl on the end machines with little work.

    From one machine, install Active Perl on a network drive. Go into the system32 directory and find PerlCRT.dll. Copy that into Perl's bin directory. Now just adding Perl's bin directory to the PATH on any given machine effectively "installs" it. Or you can just cd to Perl's bin directory and run it without it being in the PATH.

    About the general problem, the webserver will not by default have local access to the user's machine because giving that access out is a huge security risk.

Re: Access DOS System Commands
by belg4mit (Prior) on Jun 26, 2003 at 20:10 UTC
    It's really not clear what you want to do, other than that it would seem to be highly insecure. So to answer some of the possible interpretations of this question:
    • executing command.com -c dir should run the built in dir command
    • Could you use dosemu and do whatever it is you need done on the linux box?
    • Have the user upload the file to be processed as part of the form, process them on the server and then send them back to the user
    • --
      I'm not belgian but I play one on TV.

      I appreciate the advice...I will consider all these things and the high risk and then pursue the most appropriate way to go about this program...thanks for the help...The users machines are locked down in such a way that they cannot access this site anyway so it does reduce the risk...this site will only be accessable by certain people with permission to access this site so it will be administered properly and not just thrown out for everyone to access...Thanks for everyone's answers again..
Re: Access DOS System Commands
by fglock (Vicar) on Jun 26, 2003 at 19:25 UTC

    If the files are in a Windows box, you have to mount the DOS filesystem using the Samba utilities. But you will have to use Linux commands - you can't use DOS commands in the Linux box.

      Do you think creating a batch file on a windows box would be more efficient in this case to handle the duties I am requiring? To make things simple at least.

        Moving local files is more efficient then moving files through the network, but if you are the system administrator you might not want to go to the user's machine to do it.

        Take a look at man smbclient in the Linux box.