Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

mawk 1.3.4 20240622 for DOS (Announce)

posted by bencollver Homepage, 22.08.2024, 02:09

> What, the extra "/c"? Although I may be misunderstanding, as you know
> "%COMSPEC% /c my.bat" is often how most programs shell out. But you don't
> need to explicitly call the shell if not using a .BAT file.
>
> In other words, some compilers treat system("runme") as system("command /c
> runme"). They don't try to be clever and only do it for .BATs, they do it
> for everything. (DJGPP is a little smarter than most here.) In particular,
> Turbo Pascal's Exec function (in most, but not all, TP-compatible
> compilers) explicitly needs something like Exec(getenv('COMSPEC'),' /c ' +
> myEXEname);

I ran this again, this time in the WinPE command prompt, with the following results.

C:\hxtest\win32>test.exe foo bar >test.txt

C:\hxtest\win32>type test.txt
COMSPEC=X:\i386\system32\cmd.exe
argc=3
argv[0]=C:\hxtest\win32\test.exe
argv[1]=foo
argv[2]=bar

C:\hxtest\win32>test2.exe test.exe foo bar ">test2.txt"

C:\hxtest\win32>type test2.txt
COMSPEC=X:\i386\system32\cmd.exe
argc=3
argv[0]=C:\hxtest\win32\test.exe
argv[1]=foo
argv[2]=bar


Interesting that argc=3 when running test2.exe on Windows, but argc=5 when running test2.exe on HXRT. This leads me to believe that the blame rests somewhere other than the OpenWatcom compiler.

 

Complete thread:

Back to the forum
Board view  Mix view
22033 Postings in 2032 Threads, 396 registered users, 40 users online (0 registered, 40 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum