2012年8月11日土曜日

RHash 右鍵選單 REG+VBS

REG 部份:(VBS 的路徑要設定)
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\RHash]

[HKEY_CLASSES_ROOT\*\shell\RHash\command]
@="wscript.exe C:\\portable\\RHash.vbs \"%1\""
VBS 部份:(RHash 主程式的路徑要設定)
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim argument(2)
argument(0) = "C:\portable\RHash-1.2.9-win64\rhash.exe" 'application path
Dim argumentselect
Do
argumentselect = InputBox("1 = MD5" &Chr(10) & _
                          "2 = SHA1" &Chr(10) & _
                          "3 = ED2K" &Chr(10) & _
                          "4 = CHECK" &Chr(10) & _
                          "Select Feature (Other Number=Exit)" , _
                          "Input A Number For Your Choice")
Loop While IsNumeric(argumentselect) = Flase
Select Case argumentselect
Case 1
 argument(1) = "-M"
Case 2
 argument(1) = "-H"
Case 3
 argument(1) = "-E"
Case 4
 argument(1) = "-c"
Case else
 WScript.Quit
End select
argument(2) = WScript.Arguments.Item(0)
Return = WshShell.run("%COMSPEC% /u /k" &Chr(32) &argument(0) _
                                        &Chr(32) &argument(1) _
                                        &Chr(32) &Chr(34) &argument(2) &Chr(34) , 1 , True)

2012年8月5日日曜日

CMD 輸出至 VIM

目錄按右鍵後 會有選單把該目錄檔名輸出至 VIM
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\Vim(Directory)]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\Vim(Directory)\command]
@="\"C:\\Program Files (x86)\\Vim\\vim73\\gvim.exe\" \"+se shellcmdflag=/u/c\" \"+se enc=ucs-2le\" \"+lcd %1\" \"+0read !dir/on\""

Microsoft AppLocale Utility VBS 啟動範本

本來是用登錄檔做成右鍵選單
只是後來覺得雙擊還是比較方便使用

Set WshShell = WScript.CreateObject("WScript.Shell")
Dim argument(2)
argument(0) = "C:\Windows\AppPatch\AppLoc.exe"
argument(1) = "" 'application path(執行程式的完整路徑和檔名)
argument(2) = "" 'taiwan(/L0404),prc(/L0804),japan(/L0411),korea(/L0412) (想要執行的語系)
Return = WshShell.Run(argument(0) &Chr(32) _
                     &argument(1) &Chr(32) _
                     &argument(2) , 1, true)

2012年8月3日金曜日

Avira Free Antivirus (12) Disable Scheduler Service

Version : 12.0.0.1167

Extras -> Configuration
Expert mode -> Selected
General -> Security -> Product protection -> Protect files and registry entries from manipulation -> Not selected

cmd (require admin)
sc config AntiVirSchedulerService start= disabled

then reboot , it will disabled (only supply start , so need reboot)

***

when manual update VDF , require scheduler service

cmd (require admin)
sc config AntiVirSchedulerService start= auto
sc start AntiVirSchedulerService

this step will start scheduler service and can't stop
so when VDF update success , need disable scheduler service start mode and reboot

ps : can use services.msc to change start mode(auto/disabled)

2012年5月13日日曜日

Setting & Check Tool

Set WshShell = WScript.CreateObject("WScript.Shell")
MsgBox "Notice:" &Chr(10) & _
       "" &Chr(10) & _
       "1. Run With Administrator" &Chr(10) & _
       "2. Need Desktop Experience(WS2008R2)" &Chr(10) & _
       "3. Before Use , Please Read Readme" , 0 , "Setting & Check Tool"
Dim regpath(15)
 regpath(0) = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
 regpath(1) = "RegisteredOwner"
 regpath(2) = "RegisteredOrganization"
 regpath(3) = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\DisableAutoplay"
 regpath(4) = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA"
 regpath(5) = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\"
 regpath(6) = "Hidden"
 regpath(7) = "HideFileExt"
 regpath(8) = "ShowSuperHidden"
 regpath(9) = "SeparateProcess"
 regpath(10) = "ShowCompColor"
 regpath(11) = "SharingWizardOn"
 regpath(12) = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\IconsOnly"
Dim osselect
Do
osselect = InputBox("1 = Setting Windows 7" &Chr(10) & _
                    "2 = Setting Windows Server 2008 R2" &Chr(10) & _
                    "3 = Check Setting" &Chr(10) & _
                    "4 = Misc Setting" &Chr(10) & _
                    "9 = Readme" , _
                    "Select Feature (0=Exit)" , _
                    "Input A Number For Your Choice")
Loop While IsNumeric(osselect) = Flase
Select Case osselect
Case 0
Case 1
 ' Return = WshShell.run("%COMSPEC% /k sc config wscsvc start= disabled" , 1 , True)
 Return = WshShell.run("sc config wscsvc start= disabled" , 1 , True)
 Call sharesetting
Case 2
 Return = WshShell.run("sc config Themes start= auto" , 1 , True)
 Return = WshShell.run("sc config AudioSrv start= auto" , 1 , True)
 Call sharesetting
Case 3
 Call checksetting
Case 4
 Call miscsetting
Case 9
 Call readme
Case else
 MsgBox "Error Select & Exit" , 0 , "Message"
End select

Sub sharesetting
 Return = WshShell.run("sc config WinDefend start= disabled" , 1 , True)
 Return = WshShell.run("sc config MpsSvc start= disabled" , 1 , True)
 WshShell.RegWrite regpath(0) & regpath(1) , "Belldandy" , "REG_SZ"
 WshShell.RegWrite regpath(0) & regpath(2) , "Syaorin" , "REG_SZ"
 WshShell.RegWrite regpath(3) , 1 , "REG_DWORD"
 WshShell.RegWrite regpath(4) , 0 , "REG_DWORD"
 WshShell.RegWrite regpath(5) & regpath(6), 1 , "REG_DWORD"
 WshShell.RegWrite regpath(5) & regpath(7), 0 , "REG_DWORD"
 WshShell.RegWrite regpath(5) & regpath(8), 1 , "REG_DWORD"
 WshShell.RegWrite regpath(5) & regpath(9), 1 , "REG_DWORD"
 WshShell.RegWrite regpath(5) & regpath(10), 0 , "REG_DWORD"
 WshShell.RegWrite regpath(5) & regpath(11), 0 , "REG_DWORD"
 MsgBox "Setting Success" , 0 , "Message"
Exit Sub
End Sub

Sub checksetting
Dim co(15)
 co(0) = WshShell.RegRead(regpath(0) & regpath(1))
 co(1) = WshShell.RegRead(regpath(0) & regpath(2))
 co(2) = WshShell.RegRead(regpath(5) & regpath(6))
 co(3) = WshShell.RegRead(regpath(5) & regpath(7))
 co(4) = WshShell.RegRead(regpath(5) & regpath(8))
 co(5) = WshShell.RegRead(regpath(5) & regpath(9))
 co(6) = WshShell.RegRead(regpath(5) & regpath(10))
 co(7) = WshShell.RegRead(regpath(5) & regpath(11))
If co(2) = 1 And co(3) = 0 And co(4) = 1 And co(5) = 1 And co(6) = 0 And co(7) = 0 Then
 co(8) = "Default Setting"
Else
 co(8) = "Unknow Setting"
End If
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer)
Set colSettings = objWMIService.ExecQuery _
    ("Select * from Win32_ComputerSystem")
For Each objComputer in colSettings
 co(9) = objComputer.Name
 co(10) = objComputer.Workgroup
Next
co(11) = WshShell.RegRead(regpath(3))
If co(11) = 1 Then
 co(12) = "Disabled"
Else
 co(12) = "Enabled"
End If
co(13) = WshShell.RegRead(regpath(4))
If co(13) = 0 Then
 co(14) = "Disabled"
Else
 co(14) = "Enabled"
End If
Set WinDefend = objWMIService.Get("Win32_Service.Name='WinDefend'")
Set MpsSvc = objWMIService.Get("Win32_Service.Name='MpsSvc'")
Dim checkosselect
Do
checkosselect = InputBox("1 = Check Windows 7" &Chr(10) & _
                         "2 = Check Windows Server 2008 R2" , _
                         "Select Feature (0=Exit)" , _
                         "Input A Number For Your Choice")
Loop While IsNumeric(checkosselect) = Flase
Select Case checkosselect
Case 0
Case 1
Set wscsvc = objWMIService.Get("Win32_Service.Name='wscsvc'")
MsgBox "ComputerName = " &co(9) &Chr(10) & _
       "ComputerWorkgroup = " &co(10) &Chr(10) & _
       "RegisteredOwner = " &co(0) &Chr(10) & _
       "RegisteredOrganization = " &co(1) &Chr(10) & _
       "Folder Options Setting = " &co(8) &Chr(10) & _
       "Autoplay = " &co(12) &Chr(10) & _
       "UAC = " &co(14) &Chr(10) & _
       "Security Center : " &wscsvc.State &" , " &wscsvc.StartMode &Chr(10) & _
       "Windows Defender : " &WinDefend.State &" , " &WinDefend.StartMode &Chr(10) & _
       "Windows Firewall : " &MpsSvc.State &" , " &MpsSvc.StartMode  , 0 , "Message"
Case 2
Set Themes = objWMIService.Get("Win32_Service.Name='Themes'")
Set AudioSrv = objWMIService.Get("Win32_Service.Name='AudioSrv'")
MsgBox "ComputerName = " &co(9) &Chr(10) & _
       "ComputerWorkgroup = " &co(10) &Chr(10) & _
       "RegisteredOwner = " &co(0) &Chr(10) & _
       "RegisteredOrganization = " &co(1) &Chr(10) & _
       "Folder Options Setting = " &co(8) &Chr(10) & _
       "Autoplay = " &co(12) &Chr(10) & _
       "UAC = " &co(14) &Chr(10) & _
       "Windows Defender : " &WinDefend.State &" , " &WinDefend.StartMode &Chr(10) & _
       "Windows Firewall : " &MpsSvc.State &" , " &MpsSvc.StartMode &Chr(10) & _
       "Themes : " &Themes.State &" , " &Themes.StartMode &Chr(10) & _
       "Windows Audio : " &AudioSrv.State &" , " &AudioSrv.StartMode , 0 , "Message"
Case else
MsgBox "Error Select & Exit" , 0 , "Message"
End select
Exit Sub
End Sub

Sub miscsetting
Dim response
response = MsgBox("IconsOnly Enable(Yes) or Disable(No)" , 4, "Message")
If response = 6 Then
 WshShell.RegWrite regpath(12) , 1 , "REG_DWORD"
Else
 WshShell.RegWrite regpath(12) , 0 , "REG_DWORD"
End If
Exit Sub
End Sub

Sub readme
MsgBox "Setting Feature:" &Chr(10) & _
       "RegisteredOwner -> Belldandy" &Chr(10) & _
       "RegisteredOrganization -> Syaorin" &Chr(10) & _
       "Folder Option -> Default Setting" &Chr(10) & _
       "AutoPlay -> Disabled" &Chr(10) & _
       "User Account Control -> Disabled" &Chr(10) & _
       "Security Center -> Disabled (Windows 7 Only)" &Chr(10) & _
       "Windows Defender -> Disabled" &Chr(10) & _
       "Windows Firewall -> Disabled" &Chr(10) & _
       "Themes -> Auto (Windows Server 2008 R2 Only)" &Chr(10) & _
       "Windows Audio -> Auto (Windows Server 2008 R2 Only)" &Chr(10) & _
       "" &Chr(10) & _
       "Folder Option(Default Setting):" &Chr(10) & _
       "Control Panel -> Folder Options -> View -> Advanced settings ->" &Chr(10) & _
       "Hidden files and folders -> Show hidden files, folders, and drives" &Chr(10) & _
       "Hide extensions for known file types -> Not selected" &Chr(10) & _
       "Hide protected operating system files (Recommended) -> Not selected" &Chr(10) & _
       "Launch folder windows in a separate process -> Selected" &Chr(10) & _
       "Show encrypted or compressed NTFS files in color -> Not selected" &Chr(10) & _
       "Use Sharing Wizard (Recommended) -> Not selected" , 0 , "Message"
Exit Sub
End Sub

2012年3月29日木曜日

VIM

[2012/05/06 Update]
Homepage:
http://www.vim.org/
Setting:
$VIM/_vimrc
/*
" source $VIMRUNTIME/vimrc_example.vim
" source $VIMRUNTIME/mswin.vim
source $VIM/setting.vim
*/

/etc/vim/vimrc /etc/vim/gvimrc //source /opt/setting.vim

//setting.vim
/*
set nocompatible
if has('win32') || has('win64')
 language english
 set fileformats=dos,unix
elseif has('unix')
 language en_US.UTF-8
 set fileformats=unix,dos
endif
if v:version >= 703
 autocmd InsertEnter * set nocursorcolumn nocursorline relativenumber colorcolumn=
 autocmd InsertLeave * set cursorcolumn cursorline number colorcolumn=40,80
 set colorcolumn=40,80
else
 autocmd InsertEnter * set nocursorcolumn nocursorline
 autocmd InsertLeave * set cursorcolumn cursorline
endif
if has('gui_running')
 autocmd GUIEnter * winpos 0 0
 highlight Normal guibg=black guifg=white
 highlight User1 guibg=white guifg=red
 highlight User2 guibg=white guifg=lightred
 highlight User3 guibg=white guifg=darkred
 set guioptions-=e
 set guioptions-=m
 set guioptions-=T
 set statusline=[%3*%t%*]%1*%m%r%h%w%y%*
 set statusline+=%=
 set statusline+=[%2*%{mode()}%*]
 set statusline+=[%1*%{&enc}%*]
 set statusline+=[%1*%{&fenc}%*(%1*%{&bomb}%*),%1*%{&ff}%*]
 set statusline+=[%2*%l%*,%2*%c%*(%3*%p%*%%/%3*%L%*)]
 if has('win32') || has('win64')
  autocmd InsertEnter * set noimdisable
  autocmd InsertLeave * set imdisable
  set guifont=MingLiU:h14
 elseif has('unix')
  set guifont=WenQuanYi\ Zen\ Hei\ Mono\ 14
 endif
else
 set columns=80 lines=25
 set statusline=[%t]%m%r%h%w%y
 set statusline+=%=
 set statusline+=[%{mode()}]
 set statusline+=[%{&enc}]
 set statusline+=[%{&fenc}(%{&bomb}),%{&ff}]
 set statusline+=[%l,%c(%p%%/%L)]
endif
set autoindent
set autoread
set backspace=indent,eol,start
set clipboard=unnamed
set cursorcolumn
set cursorline
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8,ucs-bom,taiwan,prc,japan,korea
set foldmethod=indent
set hlsearch
set ignorecase
set incsearch
set laststatus=2
set list
set listchars=tab:>-,eol:<,trail:=
set number
set showcmd
set smartcase
set smartindent
set splitbelow
set splitright
set wrap
syntax enable
set nobackup
set noswapfile
set nowritebackup
*/
Usage:
 [

i I a A s S r R o O //[g]J << >>
v V v //o O [g]u [g]U ~ aw is as r* < >

h j k l
+ -
(e|y)
w W b B [g]e [g]E
f F t T ; ,
'' ``
(o|i) //:ju[mps]
'' '" '[ '] '(a~z|A~Z) //:marks
% () {}
0 $ ^ _
H M L
gg G (gg|G)  *%
(f|b|d|u)
z(t|z|b)
z(o|c|r|R|m|M|n|N|i|j|k)

["(a~z|A~Z|*)](x|X|d|D|dd|c|C|cc|y|Y|yy|(d|c|y)(h|j|k|l))
["(a~z|A~Z|*)][](p|P)
. q(a~z|A~Z) []@(a~z) @@
//:reg[isters]

u r

ggVG

(?|/)(\<|\>|^|$|.) //n N :noh[lsearch]
[g]* [g]#

:[range]s[ubstitute]/{pattern}/{string}/[flags]
//[range] = (1,$|%|.|+-|'*,'*|'<,'>) :
//[flags] = (c|g|i|I|n)
//"\" "+" &
:?^*?,/^*/s={pattern}={string}=[flags]
:g[lobal]/{pattern}/[cmd]

oo

:h[elp]
q:
:opt[ions]

:se[t] all

:q[uit] wq
:clo[se]
:on[ly]
:[range]r[ead] //!
:[range]w[rite]
:sav[eas]

:X :se[t] key=

:sp[lit] ws
:vs[plit]
:new wn
:vne[w]
//w[](w|h|j|k|l|t|b|H|J|K|L|+|-|_|=)

:Exp[lore]
:Tex[plore]
:Sex[plore]
:Vex[plore]

:diffthis
:diffoff
//]c [c :diffu[pdate] :diffg[et] :diffpu[t]

:tabs
:tabe[dit]
:tabc[lose]
:tabo[nly]
:tabn[ext] gt 
:tabp[revious] :tabN[ext] gT 
:tabr[ewind] :tabfir[st]
:tabl[ast]
:tabm[ove]

:e[dit] ++enc=(utf-8|ucs-bom|taiwan|prc|japan|korea)
:se[t] (fileencoding|fenc)=(utf-8|ucs-bom|taiwan|prc|japan|korea)
:se[t] (fileformat|ff)=(dos|unix)
:se[t] (guifont|gfn)=*
清空 register jump mark
Windows 7:
Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Dim eespath
eespath = WshShell.ExpandEnvironmentStrings("%USERPROFILE%")& _
          "\_viminfo"
If (fso.FileExists(eespath)) Then
 fso.DeleteFile(eespath)
 MsgBox "Find _viminfo & Remove" , 0 , "Message"
Else
 MsgBox "Can't Find _viminfo & Exit" , 0 , "Message"
End If
Linux:
#!/bin/bash
if [ -f ~/.viminfo ] ; then
 rm ~/.viminfo
 echo "Find _viminfo & Remove"
else
 echo "Can't Find _viminfo & Exit"
fi
exit 0