中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-10-01 02:00
47,813 topics / 349,918 posts / today 0 new / 48,279 members
DOS批处理 & 脚本技术(批处理室) » Convert batch files into executable files
Printable Version  2,759 / 5
Floor1 Original Posted 2002-12-03 00:00
初级用户 Posts 23 Credits 167
TC2.0 provides a system() function. This function can execute
commands in DOS and COMMAND.COM from within a running C program. By using this function, we can very conveniently convert batch files
into executable files. The method is as follows:
For example, the batch file Sample.bat
c:
cd c:\dos
dir/p
The corresponding C program is as follows:
Sample.c
#include //the system() function is included in this library
main()
{
system("c:");
system("cd c:\dos");
system("dir/p");
}
Compile Sample.c into an executable file, and running this file will achieve the function of Sample.bat.
Floor2 MYS Posted 2002-12-03 00:00
元老会员 Posts 1,637 Credits 5,170 From 广东佛山
It works, but doing it this way means every time you call a command you have to load a copy of command.com.
In actual use it probably isn't as good as tools like BAT2EXE.
Floor3 Original Posted 2002-12-04 00:00
初级用户 Posts 23 Credits 167
BAT2EXE is probably also written in C, right? I don't know, but in a few months I will know

Because I once saw a section of C code called typeWps that could directly display WPS document files,
I think this and BAT2EXE may be somewhat similar in concept.


Work hard.....work even harder, I also want to emulate a BAT2EXE

Thank you.
Floor4 Original Posted 2002-12-04 00:00
初级用户 Posts 23 Credits 167
COMMAND.COM is the command interpreter. Doesn't BAT2EXE also need a command interpreter?

If that's really the case, then I'll have to study compiler theory. A few months may not be enough, maybe a year .


If I've written anything wrong, please point it out to me.

Thanks, everyone.
Floor5 crysis Posted 2009-05-29 02:26
初级用户 Posts 20 Credits 20
Give this a try. If it can be made resistant to cracking, it should turn out quite well.
Floor6 defanive Posted 2009-05-29 11:54
初级用户 Posts 62 Credits 111
The system approach is pure wishful thinking

Labels won't work, variables won't work, and there are a whole bunch of other problems

Every time the system function is executed, it creates a command process to run it, and destroys it as soon as it finishes, leaving nothing behind

This approach doesn't have much value anymore...
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023