China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-24 02:17
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Original] BAT and HTML Mixed Programming View 8,672 Replies 18
Original Poster Posted 2008-04-22 11:53 ·  中国 北京 电信
银牌会员
★★★
Credits 2,098
Posts 566
Joined 2007-09-11 07:27
18-year member
UID 97070
Gender Male
Status Offline
:<!--
::::::::::::::::::::::::::::::::BAT::::::::::::::::::::::::::::::::

::::::::1.执行HTML代码之前的BAT代码::::::::
@echo off
call :e Starting mshta...
pause
::::::::1.执行HTML代码之前的BAT代码::::::::

::执行HTML代码:
start mshta %0

::::::::2.执行HTML代码之后的BAT代码::::::::
call :e Mshta is executing HTML codes...
pause
::::::::2.执行HTML代码之后的BAT代码::::::::

::退出BAT:
exit/b

:::::::BAT函数定义部分:::::::
:e
echo %*
goto :eof
:::::::BAT函数定义部分:::::::

::::::::::::::::::::::::::::::::BAT::::::::::::::::::::::::::::::::
-->

<!--This sentence is used to clear the first line's :-->
<script>document.body.innerText=""</script>

<!--------------------------HTML-------------------------->
<body onkeypress=window.close()>
<hr color=red>
<marquee><font color=green>HTML Codes</font></marquee>
<hr color=red>
<!--------------------------HTML-------------------------->

<!-- BAT & HTML {s11ss@www.cn-dos.net/forum 2008-4-22}
Idea: When this file is executed as a BAT file, it exits before the HTML code part is executed;
When this file is executed as an HTML file, the BAT code part is commented out and will not be executed.
-->


[ Last edited by s11ss on 2008-4-22 at 11:55 AM ]
Recent Ratings for This Post ( 3 in total) Click for details
RaterScoreTime
knoppix7 +8 2008-04-22 12:13
scriptor +15 2008-04-22 19:54
yishanju +3 2015-10-13 20:07
Floor 2 Posted 2008-04-22 12:14 ·  中国 北京 联通
银牌会员
★★★
Credits 1,287
Posts 634
Joined 2007-05-02 15:06
19-year member
UID 87277
Gender Male
From cmd.exe
Status Offline
Good stuff...
...It feels like JS/VBS/HTML/BAT ALL IN one..........
Floor 3 Posted 2008-04-22 12:16 ·  中国 上海 联通
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Good stuff, collect.
Floor 4 Posted 2008-04-22 12:49 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
High-yield "Writer"
I now suspect that the original poster is the alternate account of a certain former moderator. Does everyone have the same feeling?
山外有山,人外有人;低调做人,努力做事。

进入网盘(各种工具)~~ 空间~~cmd学习
Floor 5 Posted 2008-04-22 13:39 ·  中国 江苏 苏州 移动
银牌会员
★★★
Credits 1,608
Posts 780
Joined 2007-10-07 10:19
18-year member
UID 99089
Gender Male
Status Offline
S11SS knows really a lot, roughly summarized as follows:
vbs
js
bat
assembly
Html
And the GUI-based programs, not sure if they are JAVA or C, etc.
And the foundation is very solid
Admiration!
Floor 6 Posted 2008-04-22 19:16 ·  中国 湖北 武汉 电信
初级用户
Credits 108
Posts 49
Joined 2008-02-26 18:54
18-year member
UID 111491
Gender Male
Status Offline
Creative and worthy of learning
Floor 7 Posted 2008-04-22 19:53 ·  德国
银牌会员
★★★
Credits 1,187
Posts 555
Joined 2006-12-21 07:35
19-year member
UID 74129
Gender Male
Status Offline
Originally posted by s11ss at 2008-4-22 11:53:
:<!--
::::::::::::::::::::::::::::::::BAT::::::::::::::::::::::::::::::::

::::::::1.执行HTML代码之前的BAT代码::::::::
@echo off
call :e Starting mshta...
pause
::::::::1.执 ...



You're really good, I finally found what I've been trying to achieve for a long time!!
First, I'll bookmark you and then experiment!!

Ps: Who knows how you came up with this! Hahaha~~
Hey, it's been a long time since I came here, and when I do, I just observe!

When I see something good, I have to praise it, and when I see something bad, I have to criticize it!
Hahaha~~~
Keep it up~~
Floor 8 Posted 2008-04-22 19:53 ·  德国
银牌会员
★★★
Credits 1,187
Posts 555
Joined 2006-12-21 07:35
19-year member
UID 74129
Gender Male
Status Offline
Originally posted by plp626 at 2008-4-22 12:49:
A highly productive "writer"
I now suspect that the original poster is the马甲 of a certain former moderator. Does everyone have the same feeling?



Hehe~ You are Caicai!!
Floor 9 Posted 2008-04-22 19:55 ·  德国
银牌会员
★★★
Credits 1,187
Posts 555
Joined 2006-12-21 07:35
19-year member
UID 74129
Gender Male
Status Offline
Originally posted by s11ss at 2008-4-22 11:53:
:<!--
::::::::::::::::::::::::::::::::BAT::::::::::::::::::::::::::::::::

::::::::1.执行HTML代码之前的BAT代码::::::::
@echo off
call :e Starting mshta...
pause
::::::::1.执 ...



Give you my highest score: 15

Basically don't remember the function of adding points!! Add it for you this time~~
:)
Floor 10 Posted 2008-04-22 20:01 ·  德国
银牌会员
★★★
Credits 1,187
Posts 555
Joined 2006-12-21 07:35
19-year member
UID 74129
Gender Male
Status Offline
Okay, the test is done, there's an idea::

What I want to say is: Can bat commands be added within the <html code segment>, of course not talking about using object.run (xxxx) and so on!

Or is there any workaround?

---------

Is my this idea impossible to achieve?
Floor 11 Posted 2008-04-22 20:49 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
I've always been Caicai.

Regarding the original poster's thread, its idea is to apply the idea of VBS mixed programming to the HTML language, but everyone's knowledge is not as broad as the original poster's (like I'm not a computer major, now I only know BAT, but I'm eager to learn!).

Just give a random example of mixed programming to express the idea of the original poster's thread (I only know a little VBS):
' 2>nul 3>nul&@echo off&cls
'&start wscript.exe /nologo /e:vbs %0&exit
createobject("sapi.spvoice").speak("ger lee shir joan gwaur DOS lieng merng")
msgbox "这里是中国DOS联盟!",,"Welcome"

Original thread: http://www.cn-dos.net/forum/viewthread.php?tid=39082&fpage=1&highlight=

The only difference from this thread is that this thread uses mshta to interpret the bat code as HTML language, I don't know if the original poster, what I said is correct?

Simplify the original poster's code to facilitate everyone's understanding of the idea:

:<!--

@rem /* ---------- bat code part ------------------------
@echo off
echo Write any code here,
echo The following will start HTML
pause
::-----------The following sentence interprets the bat code as HTML language,
start mshta %0
exit::Remember to exit cmd
rem ------------------------------------------------ */

Learn and use immediately: (I just learned from the original poster's thread)

In HTML language, the comment is <!-- ..(can be line-wrapped)... -->
From this, it can be seen that when mshta interprets this bat code, the part from the first sentence to the following sentence is skipped.

From this, this code has a big advantage compared with <%0 more +? >tmp.html in that there is no temporary file generated.

-->

<!--This sentence (that is, the following script sentence) is used to clear the first line (hey, I've learned how to clear the first line of HTML statements again)
Let me explain why this sentence is added
If there is no colon at the beginning of the first sentence, the bat will directly jump out due to a syntax error,
After adding it, when mshta reads the code, the first : will remain, and in order to throw it away, the following sentence is needed


--------All the above are HTML comments-------The following are the genuine HTML statements------->


<script>document.body.innerText=""</script>

<body onkeypress=window.close()>
<hr color=red>
<marquee><font color=green>HTML Codes</font></marquee>
<hr color=red>


[ Last edited by plp626 on 2008-4-28 at 07:36 PM ]
山外有山,人外有人;低调做人,努力做事。

进入网盘(各种工具)~~ 空间~~cmd学习
Floor 12 Posted 2008-04-23 08:09 ·  中国 广东 广州 白云区 电信
中级用户
★★
Credits 233
Posts 117
Joined 2007-11-28 02:38
18-year member
UID 104005
Gender Male
Status Offline
The first time I encountered it. High, amazing. Learned it
Floor 13 Posted 2008-04-23 16:52 ·  中国 山东 济南 联通
初级用户
Credits 34
Posts 16
Joined 2008-04-15 16:47
18-year member
UID 115992
Gender Male
Status Offline
Floor 14 Posted 2008-04-23 20:07 ·  中国 山东 临沂 电信
初级用户
★★
Credits 100
Posts 67
Joined 2007-06-08 16:48
19-year member
UID 90687
Gender Male
Status Offline
Floor 14:

Amazing

Floor 14:

Amazing

Floor 14:

Amazing

Floor 14:

Amazing

Floor 14:

Amazing

Floor 14:

Amazing

Floor 14:

Amazing

Floor 14:

Amazing

Floor 14:

Amazing

Floor 14:

Amazing
Recent Ratings for This Post ( 2 in total) Click for details
RaterScoreTime
BC -2 2008-12-07 14:37
yishanju -15 2015-11-13 08:20
Floor 15 Posted 2008-04-24 17:28 ·  中国 江苏 南通 电信
初级用户
Credits 30
Posts 15
Joined 2008-04-21 18:11
18-year member
UID 116522
Gender Male
Status Offline
Thanks. Good idea.
Forum Jump: