Non-proprietary solution to fscommand arguments

409 views Asked by At

I want to pass arguments and execute local batch script from swf. I am using fscommand from which i can call the batch file but i cannot send the arguments. I searched the net a lot and come with some solution.

SWF Studio

Flash Studio and some more

but i need some free or cheap solution. Paying more than $300 for using one feature doesn't make sense to me.

1

There are 1 answers

3
user1875642 On BEST ANSWER

I hope you are trying to do this in air, not in browser.

In that case you can include extendedDesktop profile support in your app descriptor file like this:

<supportedProfiles>extendedDesktop</supportedProfiles>

And then you can launch your batch file like that:

 protected function launchBatchWithParam(batchFileName:String, arguments:Array):void{
    var params:NativeProcessStartupInfo = new NativeProcessStartupInfo();
    params.arguments = new <String>['/C',File.applicationDirectory.nativePath+'/'+batchFileName];
        for each(var arg:String in arguments){
             params.arguments.push(arg);
        }
    var cmdFile:File =  File.applicationDirectory.resolvePath('C:\\WINDOWS\\system32\\cmd.exe');
    params.executable =  cmdFile;
    var process:NativeProcess = new NativeProcess();
    process.start(params);                  
}

You have to launch your bat with the help of cmd.exe as .bat files are forbidden because of questionable security concerns of adobe's folks.