我想从swf传递参数并执行本地批处理脚本。我使用的是fscommand,我可以从其中调用批处理文件,但不能发送参数。我在网上搜索了很多次,找到了一些解决方案。
SWF Studio
Flash Studio和更多
但我需要一些免费或便宜的解决方案。花300多美元使用一个功能对我来说是没有意义的。
发布于 2012-12-26 22:05:47
我希望你是在air中尝试这样做,而不是在浏览器中。
在这种情况下,您可以在您的应用程序描述符文件中包含extendedDesktop配置文件支持,如下所示:
<supportedProfiles>extendedDesktop</supportedProfiles>然后你可以像这样启动你的批处理文件:
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);
}你必须在cmd.exe的帮助下启动你的bat,因为.bat文件是被禁止的,因为adobe的人们出于可疑的安全考虑。
https://stackoverflow.com/questions/14041123
复制相似问题