Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

remote execute a DOS batch file

Options
  • 20-09-2007 11:53am
    #1
    Closed Accounts Posts: 2,175 ✭✭✭


    Hi

    I have created a digital signage program that the users can update remotely.

    The program itself is a webpage with 2 different java script scrollers and an SWF converted from a powerpoint presentation.

    Updateing the scroller content isn't a problem, but converting the powerpoint is. It's a program called VeryDOC powerpoint converter. I use this because it allows you to run a dos batch file to execute the conversion process (so the user need only click the link and not worry about settings ;) )

    This all works fine on the local machine, but when you click the link from a remote computer, it tries to execute the batch file on the same machine, NOT on the server....

    I have been 2 days trying to figure this out and I'm not getting anywhere.

    The batch file content is as follows:
    pptconv.exe -width 666 -height 500 -swfrate 12 -swfmouse 0 -
    swfdelay 0 -swfloop 1 -swfloadbar 0 -swfctrolbar 0
     "c:\inetpub\wwwroot\scroll\ppt\mounthawk.ppt" "c:\inetpub\wwwroot\scroll\img\mounthawk.swf"
    

    It seems I need a way to specify the machine name in the batch file. It's called "PUBLICPRESENT".

    If it can't be done in the batch file, I wonder if it can be done in PHP maybe?
    I'm really at a loss here, so any help would be VERY much appreciated

    Thanks and regards


Comments

  • Banned (with Prison Access) Posts: 25,234 ✭✭✭✭Sponge Bob


    remote execution of batch files goes against every security principle

    what/who is calling it , a server with network admin rights or another workstation with a network user ??

    if you remote double click the bat runs on the machine you click from in effect


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Assuming that the pptconv.exe is a standalone executable file (and no libraries), you can do this without any remote execution.

    Create a share on the server, on the "c:\inetpub\wwwroot" folder. Call it wwwroot. Give access only to those people who need it - making changes to files in this folder allows people to make changes the website. So best not to give too many people access.

    Then copy the pptconv.exe file into that folder*.

    Then alter the batch file to the below.
    "\\publicpresent\wwwroot\pptconv.exe" -width 666 -height 500 -swfrate 12 -swfmouse 0 -
    swfdelay 0 -swfloop 1 -swfloadbar 0 -swfctrolbar 0
     "\\publicpresent\wwwroot\scroll\ppt\mounthawk.ppt" "\\publicpresent\wwwroot\scroll\img\mounthawk.swf"
    

    *This is still not necessarily recommended. A better batch file would check to see if the converter is installed locally before proceeding and if not it would install the software.


  • Banned (with Prison Access) Posts: 25,234 ✭✭✭✭Sponge Bob


    run it in the www process seamus is it ???


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    :eek:

    Jaysus no :D

    What I'm guessing is that he needs someone to be able to upload a powerpoint presentation to a folder, then convert it to SWF. This swf is then displayed on the webpage...

    So someone uploads the PPT to that specific folder called "mounthawk.ppt", then runs the batch file, and the ppt gets copied/converted to a SWF in the other folder and appears on the webpage.

    I can think of five million easier ways of doing this, but if the man wants to use a batch file...


  • Closed Accounts Posts: 2,175 ✭✭✭chamlis


    seamus wrote:
    :eek:

    Jaysus no :D

    What I'm guessing is that he needs someone to be able to upload a powerpoint presentation to a folder, then convert it to SWF. This swf is then displayed on the webpage...

    So someone uploads the PPT to that specific folder called "mounthawk.ppt", then runs the batch file, and the ppt gets copied/converted to a SWF in the other folder and appears on the webpage.

    I can think of five million easier ways of doing this, but if the man wants to use a batch file...
    You got it in one.

    I'd love to hear the 5 million other ways of doing it. I'm open to ANY suggestions at this point -_-

    It's a batch file because the veryDOC SWF converter has a batch facility. Means the user doesn't have to go through the program and choose settigns etc, they just click "convert".

    If I had my way and people listened to me in the first place, I'd have just gotten them to export the powerpoint to HTML. Not good enough though as it doesn't keep transitions or animations.


  • Advertisement
  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Well the way I'd do it is to provide a form where the user uploads the .PPT, then this script kicks off the batch file/executable which does the conversion.

    This method comes with its own security issues, because you're running it as the IIS user, but mainly it means that you only have to install the converter software on the webserver, and you don't have to give anyone access to any of the folders on it.

    You could also set up a scheduled task that runs every ten minutes or so. It checks if there's a new PPT in the folder, if so it converts it, if not it exits. This easier to lock down than the former method but obviously users have to wait for it to be converted, and you also have the overhead of a scheduled task doing nothing for 99% of the time.


  • Closed Accounts Posts: 2,175 ✭✭✭chamlis


    Supposedly there is a way for ASP to execute a batch script. My boss found this:
    <% 
        set wshell = CreateObject("WScript.Shell") 
        wshell.run "c:\file.bat" 
        set wshell = nothing 
    %>
    

    I know zero about ASP and have no clue how to even implement this, or even what the file extension should be if it's another script page to be called from a form etc (I'm assuming ".asp" would do it....).

    Now, if I could get THIS to work: http://support.microsoft.com/kb/311765/

    all my problems would be solved....


  • Closed Accounts Posts: 2,175 ✭✭✭chamlis


    Just an update:

    I have the batch script running in scheduled tasks and is working great.

    Thanks for all the advice ;)


Advertisement