User Tag List

Results 1 to 9 of 9

Thread: How do I execute a .bat (batch file) from my application?

  1. #1
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro

    Join Date
    Apr 2008
    Posts
    202
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    How do I execute a .bat (batch file) from my application?

    Hi, I'm trying to execute a simple batch file using execute External Program, but the console window just flashes up and vanishes and the batch file is not executed. If I double click the file in windows manually, the batch file gets executed correctly.

    Is there something special about executing batch files? I tried all the options(Hide, Wait Until end but I get the same result each time)

    * Timer is greater than 01''-00
    + Run this event once
    Special : Execute external program "C:\BLA\Projects\steamworks_sdk_144\sdk\tools\Cont entBuilder\run_build.bat""" (wait)

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro

    Join Date
    Apr 2008
    Posts
    202
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Cancel that, I tried a different batch file and it worked fine. Something weird with the Steam batch file that I'm trying to execute I guess..

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro

    Join Date
    Apr 2008
    Posts
    202
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by grimmy View Post
    Cancel that, I tried a different batch file and it worked fine. Something weird with the Steam batch file that I'm trying to execute I guess..
    Actually, just using the file object to set the same directory as the batch file before execution makes it all work!

  4. #4
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Dec 2006
    Posts
    257
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't forget "Execute in Console" Object can do more.

  5. #5
    Clickteam Clickteam
    Danny's Avatar
    Join Date
    Aug 2007
    Location
    United Kingdom
    Posts
    3,003
    Mentioned
    20 Post(s)
    Tagged
    2 Thread(s)
    Batch files (along with some older Win32 executables - ie: Basic) require the actual working directory to be passed before execution, otherwise it won't work. This is why it's best to set the directory before execution...
    Want to learn Clickteam Fusion 2.5?




  6. #6
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro

    Join Date
    Apr 2008
    Posts
    202
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Danny View Post
    Batch files (along with some older Win32 executables - ie: Basic) require the actual working directory to be passed before execution, otherwise it won't work. This is why it's best to set the directory before execution...
    Oddly, setting the directory works but only when testing. As soon as I make a build it seems the batch file wont execute any more. Could this be true?

  7. #7
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro

    Join Date
    Apr 2008
    Posts
    202
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by grimmy View Post
    Oddly, setting the directory works but only when testing. As soon as I make a build it seems the batch file wont execute any more. Could this be true?
    Same result (fine in test from MMF but does not execute in built version) using either of the following :

    -Execute External Program
    -(File) Run Application (File object)
    -Execute in Console

    I am setting the directory first using File Object- current directory DirectoryName$(pathOfBatchFIle)

    ?

  8. #8
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro

    Join Date
    Apr 2008
    Posts
    202
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by grimmy View Post
    Same result (fine in test from MMF but does not execute in built version) using either of the following :

    -Execute External Program
    -(File) Run Application (File object)
    -Execute in Console

    I am setting the directory first using File Object- current directory DirectoryName$(pathOfBatchFIle)

    ?
    I got this working. The File Object- current directory DirectoryName$(pathOfBatchFIle) was missing the drive letter for some reason...so I appended with Drive$(pathOfBatchFIle).

  9. #9
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleInstall Creator Pro
    Christian_Wheel's Avatar
    Join Date
    Mar 2010
    Location
    Los Angeles
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Another approach would be to modify the batch file and add commands to the top to actually change the working drive and directory to the one you need. For example:

    @C:
    @CD "\BATCHFILES\"

Similar Threads

  1. Trying to create files batch file doesn't run
    By SanjiSasuke in forum Fusion 2.5 Free Version
    Replies: 1
    Last Post: 23rd May 2018, 09:03 PM
  2. Problem running batch file in mmf2
    By Redsquirrel in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 9th November 2010, 10:15 AM
  3. Execute application with Com+ object
    By DJFuego in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 13th October 2010, 01:02 PM
  4. Creating batch file (Help!)
    By Ran_TH in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 15th July 2008, 03:57 AM
  5. Running a batch file BEFORE uninstal.exe runs
    By Troy in forum Install Creator and Patch Maker
    Replies: 5
    Last Post: 11th August 2007, 11:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •