• 9th August 2009 - By Bill Nunney

    So i’ve been writing some CD launchers recently with some handy tools on. One thing i had major trouble with was getting a Projector .exe to run programs from sub directorys. Luckily i figured it out :) so heres how…

    First in your CD/DVD root directory place a folder named “fscommand” this is the only folder which the projector will be able to see (from my experience, though there are some other methods about).

    011

    Then within your “fscommand” folder create a batch file (just create a .txt file and rename to .bat). I called mine “RUN.bat”.

    021

    Now right-click on the bat file and select “edit” (this will open the batch file with notepad).

    now we need to put in some code.

    Here is my example:

    @echo off
    
    start "" "../programs/ProcessExplorerNt/procexp.exe"
    
    @exit

    This path is relative to the “fscommand” folder (../ going up a directory to our root).

    Now in your FLA actions layer:

    fscommand("exec", "RUN.bat");

    This will simply look into the “fscommand” folder and execute the bat file, which in turn will run our program.

    also note that you must publish to Windows Projector (in your publish settings) and run the exe to test “fscommand”, ctrl + enter wont work here.

    Hope this helps.

    Stay Cool

    -Bill

  • 6 Comments to “AS3: How to Run Applications from a Flash Projector EXE with Actionscript 3 and Batch Files”

    • Panda on 10 August, 2009

      thank you very much!
      this is EXACTLY what I was searchin for.

    • Bill Nunney on 11 August, 2009

      Glad i could help, This one gave me major headaches to figure out :p

    • mando on 3 October, 2009

      Creative>>>>>>>>>>>>>>>>>>>>

      Thanks

    • xdeath on 28 June, 2010

      if i were to runa batch file using fscommand, would it return the results to flash? and if i wanted to send the results to a variable i’d just say “variable = fscommand(”run.bat”);” yes?

    • dani on 30 June, 2010

      Hello, Thank you.
      but when i use (..) for up to root folder in batch file, there is no action.
      so I’m using this:
      @echo off

      start “” “/1/1.exe”

      @exit

      also We can use this for open pdf files with adobe reader.
      if we use getURL, flash open pdf in to default web browser, this is not professional work, but when flash use a .bat file it will open in a single file.

      thank you for your script.
      regards,
      Dani Day Helm

    • Ahmad on 28 July, 2010

      Hello.
      This is a good idea, but it does not work in windows 7!
      It’s a very big problem for me and I can’t solve it.

    Leave a Reply