[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[工具合集] cmd窗口显示图片

这个我开始也感到意外,但是确实做到了;

用法: 程序名 参数

第一个参数为位图文件的路径

大家可以找一个bmp图片拖放到cmd窗口试试,哈哈,有惊喜!

送三方命令行程序如下:
(请保存下面代码为test.vbs,桌面双击它获得改程序)
  1. bs=_
  2. "NpFkAMAAAAABAAAA//PAAgLAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYDAAA4wH66AA0mQzhgbAM1cIUhWazBCcy92ZyFWbgMWYu52b0BiYlBic15GIp5GIE90Ug02bkVmLN0gCkAAAAAAAAAwz"+_
  3. "nhQjLagZevoBm59iGYm3pnRde3oBm5N5Zwm3AagZejgGo5tiGYm3knhYejoBm59iGcm3TagZe3LIt5tiGYm3Sl2YotoBm5NAAAAAAAAAAAAAAAAAAAAAQVEAAwUADAwBBcXTAAAAAAAAAAA4A8QALEgBAAAEAAAAQAAAAAEAAA6U"+_
  4. "AAAAQBAAAAGAAAAAABAAQAAAAIAAAQAAAAAAAAAAEAAAAAAAAAAAwBAAAABAAAAAAAwAAAAAAAAEAAAEAAAAAABAAABAAAAAAAAEAAAAAAAAAAAAAAAAgBAA0EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"+_
  5. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQVQhFMAAAAAAAQAAAAQAAAAAAAAAABAAAAAAAAAAAAAAAAAAAgAAA4VBFWxAAAAAAAQAAA"+_
  6. "AAFAAAgBAAAAEAAAAAAAAAAAAAAAAAA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FhXa0Blc"+_
  24. "vNWZzNHAAAgQpRnQsRHAAUGepRHAAcUZ0R0QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"+_
  25. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"+_
  26. "":set rs=CreateObject("ADODB.Recordset")
  27. set ado=CreateObject("ADODB.Stream")
  28. l=len(bs):ss="":for k=1 to l step 4096:ss=ss+ub64(mid(bs,k,4096)):next:l=len(ss)
  29. rs.fields.append "b",205,l/2:rs.open:rs.addnew:rs("b")=ss+chrb(0):rs.update
  30. ado.mode=3:ado.type=1:ado.open:ado.write rs("b").getchunk(l/2)
  31. ado.savetofile "bmp.exe",2:ado.close
  32. function ub64(s):dim t(4),b(3):ub64="":n=len(s):r=2
  33. if n mod 4<>0 then exit function:end if:for i=1 to n step 4:for j=0 to 3
  34. a=asc(mid(s,i+j,1)):if a=43 then:a=62:else if a=47 then:a=63:else if a>47 and a<58 then:_
  35. a=a+4:else if a=61 then:a=0:if r=2 then r=j-2:end if:else if a>64 and a<91 then:_
  36. a=a-65:else if a>96 and a<123 then:a=a-71:else:exit function:_
  37. end if:end if:end if:end if:end if:end if:t(j)=a:next
  38. b(0)=t(0)+t(1)*64 mod 256:b(1)=t(1)\4+t(2)*16 mod 256:b(2)=t(2)\16+t(3)*4
  39. for j=0 to r:if b(j)<16 then ub64=ub64+"0":end if:ub64=ub64+hex(b(j))
  40. next:next:end function
复制代码

[ 本帖最后由 plp626 于 2011-3-9 12:38 编辑 ]
6

评分人数

    • kdXiaoyi: 牛!但是有个小BUG:Win7x64只能显示部分图 ...技术 + 1
    • qc5111: good技术 + 1
    • tmplinshi:技术 + 1 PB + 10
    • zm900612: 我想知道怎么给别人PB+1?技术 + 1
    • foxJL: 重大发现技术 + 1

我只能说:牛!
***共同提高***

TOP

有了这,今后批处理界面将不会这么单调了

TOP

TOP

我这怎么只显示图片的一个角(左上角)

TOP

太强悍了,哈哈。高!

TOP

不过为什图片显示不全呢?

TOP

真强捍。这也做出来了,
枫中残雪:风停了,我的心却在动,让我心中的寒意走向远方

TOP

有人在dos下实现了可视化
有人在windows下的dos 打开了图片

TOP

强!&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

TOP

图片显示不完整,还有楼主那个vbs代码怎么修改源程序?

TOP

回复 1楼 的帖子

顶。只是cmd由最小到最大图片就消失了。

TOP

如果只是达到这种效果,只需要把一个程序不让它重画,再把它杀掉,它的影像就会留下来了,这并不是在CMD窗口中显示图片,而是残留一个恰好处于CMD窗口中的影像。
下面是一个例子,只是不借用其他工具的话无法定位CMD窗口坐标,图片有可能显示到外面。
PicTest.bat
  1. @echo off
  2. set "pic=D:\aa.jpg"
  3. set "hta=%temp%\temp.hta"
  4. more "%~f0" +13 > "%hta%"
  5. echo init("%pic%");^</script^> >> "%hta%"
  6. start mshta "%hta%"
  7. set "t=Titled Spring Brother"
  8. nircmd wait 500
  9. nircmd win activate title "%t%"
  10. nircmd wait 200
  11. nircmd win sendmsg title "%t%" 0x0B 0 0
  12. nircmd win sendmsg title "%t%" 0x10 0 0
  13. pause
  14. <html><HTA:APPLICATION Application ICON="mspaint.exe" BORDER="None"
  15. SCROLL="No" INNERBORDER="No" SELECTION="No" /><head>
  16. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  17. <title>Titled Spring Brother</title><script type="text/javascript">
  18. function init(picurl){var sHTML = "<img id='pic' name='pic' src='" + picurl
  19. + "'></img>";document.write(sHTML);var p = document.getElementById("pic");
  20. window.resizeTo(p.width, p.height);setTimeout("window.close()",1000);}
  21. </script></head><body style="margin:0px;overflow:hidden;scroll:no;">
  22. <div style='position:absolute; width:100%; height:100%; border:0px;' />
  23. </body></html><script type="text/javascript">
复制代码
1

评分人数

TOP

这个是在外部打开图片的,并非在CMD窗口,只是显示在CMD输入坐标位置

TOP

楼主太强了。。。。NB...

TOP

返回列表