# I have an “as3 windows” project that requires executing the command line by calling “cmd. exe”. I have always wanted to use “haxe” for development, but I don’t know how to implement this class yet

**URL:** <https://community.haxe.org/t/i-have-an-as3-windows-project-that-requires-executing-the-command-line-by-calling-cmd-exe-i-have-always-wanted-to-use-haxe-for-development-but-i-don-t-know-how-to-implement-this-class-yet/4699>\
**Category:** Haxe\
**Created:** [October 30, 2025, 9:38am UTC](https://community.haxe.org/t/i-have-an-as3-windows-project-that-requires-executing-the-command-line-by-calling-cmd-exe-i-have-always-wanted-to-use-haxe-for-development-but-i-don-t-know-how-to-implement-this-class-yet/4699 "2025-10-30T09:38:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![785597448](https://community.haxe.org/user_avatar/community.haxe.org/785597448/32/2523_2.png) [@785597448](https://community.haxe.org/u/785597448)\
**Post date:** [October 30, 2025, 9:38am UTC](https://community.haxe.org/t/i-have-an-as3-windows-project-that-requires-executing-the-command-line-by-calling-cmd-exe-i-have-always-wanted-to-use-haxe-for-development-but-i-don-t-know-how-to-implement-this-class-yet/4699/1 "2025-10-30T09:38:53Z")

</div>

.

I have an “as3 windows” project that requires executing the command line by calling “cmd. exe”. I have always wanted to use “haxe” for development, but I don’t know how to implement this class yet

.

In AS3, I executed it this way  
.  
//Open an ‘exe’ program  
Call.open(“start Meteor.exe”);  
.  
//Use ‘cmd. exe’ to execute the command line and close the exe program.  
Call.open(“taskkill /f /im Meteor.exe”);  
.  
//Open “cmd. exe” and add files to the compressed file using “winrar. exe”, as well as copy the files.  
Call.skin(“zhiyayouxiData\ptexture\”+Object(root).id1+“\_._”);  
Call.copy(“zhiyayouxiData\pmodel\”+Object(root).id1+“.amb”,“pmodel\”+Object(root).id2+“.amb”);  
.  
I have written all of these, mainly the implementation of the “Call. as” class  
I don’t know how to implement it in ‘openfl’? Who can help me?  
.

“Call.as”

.

package code  
{  
import flash.filesystem._;  
import flash.desktop._;  
import flash.utils._;  
import flash.events._;

```haxe
public class Call
{
	private static var process: NativeProcess;
	private static var nativeProcessStartupInfo: NativeProcessStartupInfo;

	private static function newexe(EXEPath: String, parentDirectory: String = "", inistr: String = "")
	{
		nativeProcessStartupInfo = new NativeProcessStartupInfo();
		var fileexe: File = File.applicationDirectory.resolvePath(EXEPath); //bin/ffmpeg.exe
		process = new NativeProcess();
		process.addEventListener(ProgressEvent.STANDARD_INPUT_PROGRESS, input);
		process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
		process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, onErrorData);

		process.addEventListener(NativeProcessExitEvent.EXIT, onExit);
		process.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR, onIOError);
		process.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR, onIOError);

		if(fileexe.exists)
		{
			nativeProcessStartupInfo.executable = fileexe;
			if(parentDirectory == "")
			{
				nativeProcessStartupInfo.workingDirectory = fileexe.parent;
			}
			else
			{
				nativeProcessStartupInfo.workingDirectory = new File(parentDirectory);
			}
		}
		if(inistr != "")
		{
			var processArgs: Vector. < String > = new Vector. < String > ();
			var s: Array = inistr.split(" ");
			for(var i = 0; i < s.length; i++)
			{
				processArgs.push(s[i]);
			}
			nativeProcessStartupInfo.arguments = processArgs;
			process.start(nativeProcessStartupInfo);
		}
		else
		{
			process.start(nativeProcessStartupInfo);
		}
	}
	newexe("C:/Windows/System32/cmd.exe", File.applicationDirectory.nativePath);

	private static function call(e: String, f: String = "gbk")
	{
		process.standardInput.writeMultiByte(e, f);
	}
	public static function skin(e: String)
	{
		call("zhiyayouxiData\\WinRAR\\WinRAR.exe a -ep1 -apptexture ptexture.pak" + " " + e + "\n");
	}
	public static function copy(file1: String, file2: String)
	{
		call("copy" + " " + file1 + " " + file2 + "/y" + "\n");
	}
	public static function open(e: String)
	{
		call(e + "\n");
	}
	private static function input(e)
	{
		trace("成功发送数据");
	}
	private static function onOutputData(event: ProgressEvent): void
	{
		var jqm = process.standardOutput.readMultiByte(process.standardOutput.bytesAvailable, "GBK");
		trace("输出的数据：", jqm);
	}
	private static function onErrorData(event: ProgressEvent): void
	{
		var jqm = process.standardOutput.readMultiByte(process.standardOutput.bytesAvailable, "GBK");
		trace("出错的信息是：" + jqm);
	}
	private static function onExit(e): void
	{
		trace("调用的exe关闭了");
	}
	private static function onIOError(event: IOErrorEvent): void
	{}
}

```

}

.

---

<div class="post-metadata">

**Author:** ![785597448](https://community.haxe.org/user_avatar/community.haxe.org/785597448/32/2523_2.png) [@785597448](https://community.haxe.org/u/785597448)\
**Post date:** [October 30, 2025, 9:39am UTC](https://community.haxe.org/t/i-have-an-as3-windows-project-that-requires-executing-the-command-line-by-calling-cmd-exe-i-have-always-wanted-to-use-haxe-for-development-but-i-don-t-know-how-to-implement-this-class-yet/4699/2 "2025-10-30T09:39:34Z")

</div>

.  
Has anyone done a similar project before?  
.  
How to implement the as class above in haxe?  
.

---

<div class="post-metadata">

**Author:** ![Igazine](https://community.haxe.org/user_avatar/community.haxe.org/igazine/32/1745_2.png) [@Igazine](https://community.haxe.org/u/Igazine)\
**Post date:** [October 30, 2025, 11:48am UTC](https://community.haxe.org/t/i-have-an-as3-windows-project-that-requires-executing-the-command-line-by-calling-cmd-exe-i-have-always-wanted-to-use-haxe-for-development-but-i-don-t-know-how-to-implement-this-class-yet/4699/3 "2025-10-30T11:48:56Z")

</div>

You have [Sys.command()](https://api.haxe.org/Sys.html#command) to initiate simple processes that you don’t need the result or output of.

Then you have the [sys.io.Process](https://api.haxe.org/sys/io/Process.html#Process) class with much more control over the spawned processes (kill, close, exit code, stdin, stdout, etc.)

Finally OpenFL not so long ago introduced the [NativeProcess](https://api.openfl.org/openfl/desktop/NativeProcess.html) implementation which I believe is a 1:1 representation of the ActionScript version, so the transition should be straightforward and painless.

---

<div class="post-metadata">

**Author:** ![785597448](https://community.haxe.org/user_avatar/community.haxe.org/785597448/32/2523_2.png) [@785597448](https://community.haxe.org/u/785597448)\
**Post date:** [October 30, 2025, 12:21pm UTC](https://community.haxe.org/t/i-have-an-as3-windows-project-that-requires-executing-the-command-line-by-calling-cmd-exe-i-have-always-wanted-to-use-haxe-for-development-but-i-don-t-know-how-to-implement-this-class-yet/4699/4 "2025-10-30T12:21:02Z")

</div>

.

Thank you for your response

.

First of all, I’m sorry because I don’t know English and they are all software translations, so there may be some differences

.
