|
s11ss
银牌会员
    
积分 2098
发帖 566
注册 2007-9-11
状态 离线
|
  『楼 主』:
[原创]BAT与HTML混合编程
使用 LLM 解释/回答一下
:<!--
::::::::::::::::::::::::::::::::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::::::::::::::::::::::::::::::::
-->
<!--此句用来清除第一行的:-->
<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}
思路:当此文件被当作BAT文件执行时,未执行到HTML代码部分时就已退出;
当此文件被当作HTML文件执行时,BAT代码部分被注释,不会被执行。
-->
Last edited by s11ss on 2008-4-22 at 11:55 AM ]
:<!--
::::::::::::::::::::::::::::::::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 ]
|
|
2008-4-22 11:53 |
|
|
knoppix7
银牌会员
    
积分 1287
发帖 634
注册 2007-5-2 来自 cmd.exe
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
好东西...
...JS/VBS/HTML/BAT ALL IN one的感觉..........
Good stuff...
...It feels like JS/VBS/HTML/BAT ALL IN one..........
|
|
2008-4-22 12:14 |
|
|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
|
2008-4-22 12:16 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
高产的”作家“
我现在怀疑楼主是原来某位版主的马甲,大家可否有同感?
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学习 |
|
2008-4-22 12:49 |
|
|
huahua0919
银牌会员
    
积分 1608
发帖 780
注册 2007-10-7
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
S11SS懂得还真多,大概总结下有:
vbs
js
bat
汇编
Html
还有基于GUI的程序不知道是JAVA 还好C等
而且根底都很扎实
佩服佩服!
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!
|
|
2008-4-22 13:39 |
|
|
learner0
初级用户
 
积分 108
发帖 49
注册 2008-2-26
状态 离线
|
|
2008-4-22 19:16 |
|
|
scriptor
银牌会员
    
积分 1187
发帖 555
注册 2006-12-21
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
Originally posted by s11ss at 2008-4-22 11:53:
:<!--
::::::::::::::::::::::::::::::::BAT::::::::::::::::::::::::::::::::
::::::::1.执行HTML代码之前的BAT代码::::::::
@echo off
call :e Starting mshta...
pause
::::::::1.执 ...
你真强,我算是找到我一直以来要实现的了!!
先顶你在实验一下!!
ps: 鬼晓得你是怎么想到的! 哈哈哈~~
哎,又很久没来了,来了我也是观花!
看到很好的我就要赞一下, 看到不好的我也要砍一下!
哈哈哈~~~
加油啊~~
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~~
|
|
2008-4-22 19:53 |
|
|
scriptor
银牌会员
    
积分 1187
发帖 555
注册 2006-12-21
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
Originally posted by plp626 at 2008-4-22 12:49:
高产的”作家“
我现在怀疑楼主是原来某位版主的马甲,大家可否有同感?
呵呵~你是菜菜!!
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!!
|
|
2008-4-22 19:53 |
|
|
scriptor
银牌会员
    
积分 1187
发帖 555
注册 2006-12-21
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
Originally posted by s11ss at 2008-4-22 11:53:
:<!--
::::::::::::::::::::::::::::::::BAT::::::::::::::::::::::::::::::::
::::::::1.执行HTML代码之前的BAT代码::::::::
@echo off
call :e Starting mshta...
pause
::::::::1.执 ...
给你加我的最高分: 15
基本不记得加分的功能啊!! 这次先给你加加~~
:)
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~~
:)
|
|
2008-4-22 19:55 |
|
|
scriptor
银牌会员
    
积分 1187
发帖 555
注册 2006-12-21
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
好,测试过了,有个想法::
我想说的是: 能不能在<html code segment > 内,加入 bat命令, 当然不是说使用
object.run (xxxx) 之类的!
或者有什么变通的办法么?
---------
我的这个想法 是不是 不可能实现啊?
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?
|
|
2008-4-22 20:01 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
我一直是菜菜。
就楼主这个帖来说,其思想就是把VBS混合编程的思想用到html语言上,只是大家的知识面没有楼主那么宽(像我不是学计算机的,现在就懂个BAT,但我好学!)
随便举个混合编程的例子,来表达(我就懂点点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"
原帖: http://www.cn-dos.net/forum/viewthread.php?tid=39082&fpage=1&highlight=
不同与此贴的仅仅是此贴用的是mshta来把bat的代码当作html语言来解释,不知楼主,我说的对不对?
将楼主的代码精简,方便大家理解思想:
:<!--
@rem /* ---------- bat代码部分 ------------------------
@echo off
echo 这里随便写代码,
echo 下面将启动html了
pause
::-----------下面这句 将bat代码当作html语言来解释,
start mshta %0
exit::记得退出cmd
rem ------------------------------------------------ */
现学现用:(我刚从楼主的帖子里学到的)
在html语言里注释就是 <!-- ..(可以换行)... -->
由此看来当mshta解释这个bat代码时候,从第一句到下面这句之间的部分被跳过。
由此看来次代码和<%0 more +? >tmp.html相比一大优点就是没有生成临时文件.
-->
<!--此句(就是下面script那就)用来清除第一行的(这不,又学到了如何清除第一行的html语句)
我来解释为什么要添这句
如果第一句开头没有冒号bat将因语法错误直接跳出,
加上后当mshta读取代码是第一个:会留下,为了再丢掉就得用下面的语句
--------我的上面全是html的注释-------我的下面就是正二八经的html语句了------->
<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 ]
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学习 |
|
2008-4-22 20:49 |
|
|
dslz666
中级用户
  
积分 233
发帖 117
注册 2007-11-28
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
第一次碰到。高,厉害。学习了
The first time I encountered it. High, amazing. Learned it
|
|
2008-4-23 08:09 |
|
|
binghehan100
初级用户
 
积分 34
发帖 16
注册 2008-4-15
状态 离线
|
|
2008-4-23 16:52 |
|
|
rzwwj1
初级用户
 
积分 100
发帖 67
注册 2007-6-8
状态 离线
|
|
2008-4-23 20:07 |
|
|
cctv8068
初级用户
 
积分 30
发帖 15
注册 2008-4-21
状态 离线
|
|
2008-4-24 17:28 |
|