上网常用- @echo off
- ::右键添加"用记事本打开"
- reg add "hkcr\*\shell\OpenInNotepad" /f /ve /d 用记事本打开
- reg add "hkcr\*\shell\OpenInNotepad\command" /f /ve /d "notepad.exe %%1"
- ::右键添加"打开命令提示符"
- reg add "HKCR\*\shell\OpenInMsdos" /ve /d 打开命令提示符 /f
- reg add "HKCR\*\shell\OpenInMsdos\command" /ve /d "cmd.exe /k cd %%1" /f
- reg add "HKCR\Folder\shell\OpenInMsdos" /ve /d 打开命令提示符 /f
- reg add "HKCR\Folder\shell\OpenInMsdos\command" /ve /d "cmd.exe /k cd %%1" /f
- ::右键添加"新建test.bat"
- reg add HKCR\.bat\ShellNew /v nullfile /f
- reg add HKCR\batfile /ve /d test /f
复制代码 显示系统启动的时间.vbs- for each os in getobject _
- ("winmgmts:\\.\root\cimv2:win32_operatingsystem").instances_
- wscript.echo os.lastbootuptime:next
复制代码 开机时间:net statistics workstation
上次开关机时间,本次开机时间:- strComputer = "."
- Set objWMIService = GetObject("winmgmts:" _
- & "{impersonationLevel=impersonate}!\\" _
- & strComputer & "\root\cimv2")
- Set colLoggedEvents = objWMIService.ExecQuery _
- ("Select * from Win32_NTLogEvent " _
- & "Where Logfile = 'System' And EventCode = '6005' Or EventCode = '6006'")
- For Each objEvent In colLoggedEvents
- Flag = Flag + 1
- If Flag = 1 Then
- Wscript.Echo "本次开机时间: " & FormatWMIUTC(objEvent.TimeWritten)
- ElseIf Flag = 2 Then
- Wscript.Echo "上次关机时间: " & FormatWMIUTC(objEvent.TimeWritten)
- ElseIf Flag = 3 Then
- Wscript.Echo "上次开机时间: " & FormatWMIUTC(objEvent.TimeWritten)
- Exit For
- End If
- Next
-
- 'FormatUTC
- Function FormatWMIUTC(WMIDateString)
- DS = " // :: "
- FormatWMIUTC = Left(WMIDateString,2)
- For i = 2 To 7
- FormatWMIUTC = FormatWMIUTC & Mid(WMIDateString, i * 2 - 1, 2) & Mid(DS,i,1)
- Next
- 'FormatWMIUTC = Mid(WMIDateString, 1, 4) & "年" _
- ' & Mid(WMIDateString, 5, 2) & "月" _
- ' & Mid(WMIDateString, 7, 2) & "日 " _
- ' & Mid (WMIDateString, 9, 2) & ":" _
- ' & Mid(WMIDateString, 11, 2) & ":" _
- ' & Mid(WMIDateString,13, 2)
- End Function
复制代码
- @echo off
- ::复制系统某类型文件到指定目录内
- if not exist vbs md vbs
- for /f "delims=" %%a in ('dir/a-d/s/b c:\*.vbs')do call:arr "%%a"
- exit
- :arr
- set "n="
- if exist "vbs\%~nx1" call:ren %*
- echo f|xcopy /h "%~1" "vbs\%~n1%n%%~x1"
- exit/b
-
- :ren
- set n=1
- :ren_1
- if exist "vbs\%~n1_%n%%~x1" set/a n+=1&goto:ren_1
- set n=_%n%&goto:eof
复制代码
- ::显示IP
- mshta "javascript:alert(new ActiveXObject("rcbdyctl.Setting").GetIPAddress);window.close();"
复制代码 刷新DNS:ipconfig /flushdns- '目标文件名
- Const TargetFileName="fugai-def-files.rar"
- Const MD5="...
- ...."
- Set oStream = CreateObject("Adodb.Stream")
- Hex2Bin HexString,TargetFileName
- Sub Hex2Bin(strHex,strFileName)
- Dim objStream,objXML,objElement
- Set objStream = Createobject("Adodb.Stream")
- Set objXML = Createobject("Microsoft.XMLDOM")
- Set objElement = objXML.CreateElement("oTmpElement")
- objElement.DataType = "bin.hex"
- objElement.NodeTypedValue = strHex
- With objStream
- .Type = 1
- .Mode = 3
- .Open
- .Write objElement.NodeTypedValue
- .SaveToFile strFileName
- End With
- End Sub
复制代码
- '作者:hat@cn-dos.net
- '来个VBS,保存成download.vbs可以直接在命令行中执行
- 'On Error Resume Next
- Dim fso, s, FileName, URL, HTML, cdo
-
- URL = "http://www.cn-dos.net" '需要下载的页面路径
- FileName = "C:\test\" & CStr(Year(Now) & Month(Now) & Day(Now)) & ".mht" '保存的文件名
-
- Set cdo = CreateObject("cdo.Message")
- cdo.CreateMHTMLBody URL, 31
- Set s = cdo.GetStream
- s.SaveToFile FileName, 2
- s.Close
- msgbox("完成")
复制代码 借助sed 去掉网页中的 <> 标签- curl http://www.for-ever.cn/nod32/ | sed -e "s/<[^>]*>//g" >a.txt
复制代码 爱词霸 http://www.iciba.com/search?s=%word%
dict http://dict.cn/ws.php?q=%word%"- ::::::::::::::::::::::::::::::::::::::::::::::::
- ::[用法] 保存为dict.bat于当前路径后,命令行下格式: dict word
- ::::::::::::::::::::::::::::::::::::::::::::::::
- @echo off||author:plp626&<%~fs0 more +7>%tmp%\gtxt.vbs
- set "url=http://www.baidu.com/baidu?ie=gb2312&cl=3&ct=1048576&word=%1"
- cscript //NoLogo //e:vbscript %tmp%\gtxt.vbs "%url%"|more +4|findstr/v "Dr\.eye Baidu"|findstr .
- exit/b
- '
- Set oDOM = WScript.GetObject(WScript.Arguments(0))
- do until oDOM.readyState = "complete"
- WScript.sleep 100
- loop
- WScript.echo oDOM.documentElement.outerText
复制代码 1. 下载得到网页源代码- '用法:cscript //NoLogo //e:vbscript ghtm.vbs http://.....
- Set oDOM = WScript.GetObject(WScript.Arguments(0))
- do until oDOM.readyState = "complete"
- WScript.sleep 200
- loop
- WScript.echo oDOM.documentElement.outerHTM
复制代码 高压缩的VBS到any:- bs=_
- "HlkR4kTYQGgRAcPAA8/////93f/93//7vf/7v/+7v/+73///A8v5mfv5m/u5mbu5mbu5v/v3e7t5mfv3e/u3ebu3e7t3m/v1W7t3efv1W/u1Wbu1W/vzO7t1Wbt1WfvzObt1e/uzO7s1ebuzO/fxF7tzObtzOffxF7szW7szO/ex"+_
- "FXszWbexFP2/A8fv96dxFffv9adxF/ev9WcxW7cxFXcxOXcxFbev96dv9+ft12bxOfft12bxFbdv9+et1aet12bvO/frt2bvF7dt1efrtWbvOXbvF/ertaert+fpl6drtefplWbtFXbt9+epl2at9aepl+PncePnc2ar9+OncWar"+_
- ......
- "qBh26xqxq2K36xKuqsKtq3Kkwzqu65q66664qx6yKz626vaCB66265Kwqyq6qyq8q9a2K+KyaBB9asq+K5a96sqA7Bb+a9a5q4qAr4q067Kyh86+K366K2aFbCbFb7606ErBb6KH746H706G786IL7q0atK+a8KBLE7HiEbBLA7F"+_
- "7DLK7FrJbAbGNvQrxszsqsWsZsNr3sCrlr/sJrAsOsIsFrasssFHusisKsUsls6sCt+s0sYresFspsArWt/swsBtzs0rYtTtNrorprJtxFht2rItVrft5s2satls2qStutntpsuttrjtctUrHtvsOsEr5rgsktdI/r/rksatVt0s"+_
- "7r+rMEIuMtsrGsjscswsttMuVtotxrUu/tuFStwtCrfrVrEtytIrgrauhrcukuOrfu6tnsPsOtztYsxsrsju8rXuHHysjtPqgubu4tTs0uQtyuvFBEAA7A=="+_
- "":set rs=CreateObject("ADODB.Recordset")
- set ado=CreateObject("ADODB.Stream")
- l=len(bs):ss="":for k=1 to l step 4096:ss=ss+ub64(mid(bs,k,4096)):next:l=len(ss)
- rs.fields.append "b",205,l/2:rs.open:rs.addnew:rs("b")=ss+chrb(0):rs.update
- ado.mode=3:ado.type=1:ado.open:ado.write rs("b").getchunk(l/2)
- ado.savetofile "byin.gif",2:ado.close
- function ub64(s):dim t(4),b(3):ub64="":n=len(s):r=2
- if n mod 4<>0 then exit function:end if:for i=1 to n step 4:for j=0 to 3
- 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:_
- 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:_
- a=a-65:else if a>96 and a<123 then:a=a-71:else:exit function:_
- end if:end if:end if:end if:end if:end if:t(j)=a:next
- 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
- for j=0 to r:if b(j)<16 then ub64=ub64+"0":end if:ub64=ub64+hex(b(j))
- next:next:end function
复制代码 ::退格键
开始、运行
cmd
edit
ctrl+p
alt+08
保存,退出。- 'htm2txt
- set oDOM = WScript.GetObject(WScript.Arguments(0))
-
- do until oDOM.readyState = "complete"
- WScript.sleep 200
- loop
-
- WScript.Echo oDOM.Body.InnerText
复制代码
- @echo off||author:plp626
-
- set n=0
- call:xx %1 %2 a b
- echo %a% %b% +++
- exit/b
-
- :xx
- setlocal enabledelayedexpansion
- set/a k=~(1"<<"31)/10,x=%1
- for /l %%a in (1 1 10)do (
- if !x! lss !k! (set/a n+=1,x*=10) else (
- set/a r=!x!/%2 &echo !r! !x! %2 !n!&endlocal&exit/b
- )
- )
-
- ::&set %3=!r!&set %4=!n!
复制代码
[ 本帖最后由 Batcher 于 2009-3-18 21:56 编辑 ] |