Vào Notepad soạn nội dung sau rồi lưu lại dưới định dạng là .vbs.( 
VD: Hien thi cac phong chu.vbs )
dim w
set w = createobject("word.application")
w.visible = true
dim d
set d = w.documents.add
dim iFonts
iFonts = w.fontnames.count
dim i
for i = 1 To iFonts
                
              
                                            
                                
            
                       
            
                 7 trang
7 trang | 
Chia sẻ: lylyngoc | Lượt xem: 1819 | Lượt tải: 1 
              
            Bạn đang xem nội dung tài liệu Chương 1 :Thủ thuật Windows XP ( phần 6), để tải tài liệu về máy bạn click vào nút DOWNLOAD ở trên
Chương 1 :Thủ thuật Windows XP ( phần 6) 
020. Hiển thị tất cả các phông chữ có trong máy. 
 Vào Notepad soạn nội dung sau rồi lưu lại dưới định dạng là .vbs.( 
VD: Hien thi cac phong chu.vbs ) 
dim w 
set w = createobject("word.application") 
w.visible = true 
dim d 
set d = w.documents.add 
dim iFonts 
iFonts = w.fontnames.count 
dim i 
for i = 1 To iFonts 
d.content.insertafter w.fontnames(i) & vbcrlf 
d.content.insertafter "Hien thi Font chu" & vbcrlf 
d.content.insertafter "Rat de dang ma khong can su dung phan mem 
ho tro" & vbcrlf 
d.content.insertafter "LuongHuuViet" & vbcrlf 
d.content.insertafter "0913722650 0919324832 0913696000 
0913650651" & vbcrlf 
next 
dim rngParagraphs 
for i = 1 To iFonts * 4 
if (i + 3) mod 4 = 0 then 
set rngParagraphs = d.range(d.paragraphs(i + 1).range.start, 
d.paragraphs(i + 3).range.end) 
rngParagraphs.select 
w.selection.font.name = w.fontnames((i - 1) \ 4 + 1) 
end if 
next 
msgbox "Ket Thuc" 
Sau đó tiến hành thực thi file vừa tạo. 
021. Kiểm tra các account trong Windows. 
Vào Notepad soạn nội dung sau rồi lưu lại dưới định dạng là .vbs ( 
VD: Test account.vbs ) 
On Error Resume Next 
strComputer = "." 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & 
"\root\cimv2") 
Set colItems = objWMIService.ExecQuery("Select * from 
Win32_UserAccount",,48) 
For Each objItem in colItems 
Wscript.Echo "AccountType: " & objItem.AccountType 
Wscript.Echo "Caption: " & objItem.Caption 
Wscript.Echo "Description: " & objItem.Description 
Wscript.Echo "Disabled: " & objItem.Disabled 
Wscript.Echo "Domain: " & objItem.Domain 
Wscript.Echo "FullName: " & objItem.FullName 
Wscript.Echo "InstallDate: " & objItem.InstallDate 
Wscript.Echo "Lockout: " & objItem.Lockout 
Wscript.Echo "Name: " & objItem.Name 
Wscript.Echo "PasswordChangeable: " & 
objItem.PasswordChangeable 
Wscript.Echo "PasswordExpires: " & objItem.PasswordExpires 
Wscript.Echo "PasswordRequired: " & objItem.PasswordRequired 
Wscript.Echo "SID: " & objItem.SID 
Wscript.Echo "SIDType: " & objItem.SIDType 
Wscript.Echo "Status: " & objItem.Status 
Next 
Sau đó tiến hành thực thi file vừa tạo. 
022. Thay đổi thông tin người dùng trong Windows. 
Vào Notepad soạn nội dung sau rồi lưu lại dưới định dạng là .vbs ( 
VD: Change Account.vbs ) 
Option Explicit 
Set ws = WScript.CreateObject("WScript.Shell") 
Dim ws, t, p1, p2, n, g, cn, cg 
Dim itemtype 
p1 = "HKLM\Software\Microsoft\Windows NT\CurrentVersion\" 
n = ws.RegRead(p1 & "RegisteredOwner") 
g = ws.RegRead(p1 & "RegisteredOrganization") 
t = "*¤*•,¤*•,¸.¸,•*¤*•_Thong Bao_•*¤*•,¸., •*¤*" 
cn = InputBox("Dien ten nguoi su dung moi tai day:", t, n) 
If cn "" Then 
ws.RegWrite p1 & "RegisteredOwner", cn 
End If 
cg = InputBox("Dien ten dia chi, nghe nghiep hoac cong ty moi tai 
day.", t, g) 
If cg "" Then 
ws.RegWrite p1 & "RegisteredOrganization", cg 
End If 
Sau đó tiến hành thực thi file vừa tạo và làm theo hướng dẫn. 
Ngoài ra ta cũng có thể sử dụng đoạn mã sau nhưng khi lưu thành 
file .vbs thì chọn File  Save as… và chọn Unicode tại trường 
Encoding để hiển thị đúng phông Unicode. 
Option Explicit 
Set ws = WScript.CreateObject("WScript.Shell") 
Dim ws, t, p1, p2, n, g, cn, cg 
Dim itemtype 
p1 = "HKLM\Software\Microsoft\Windows NT\CurrentVersion\" 
n = ws.RegRead(p1 & "RegisteredOwner") 
g = ws.RegRead(p1 & "RegisteredOrganization") 
t = "*¤*•,¤*•,¸.¸,•*¤*•_Thông Báo_•*¤*•,¸., •*¤*" 
cn = InputBox("Điền tên người sử dụng mới tại đây :", t, n) 
If cn "" Then 
ws.RegWrite p1 & "RegisteredOwner", cn 
End If 
cg = InputBox("Điền tên địa chỉ, nghề nghiệp hoặc công ty mới tại 
đây :", t, g) 
If cg "" Then 
ws.RegWrite p1 & "RegisteredOrganization", cg 
End If 
023. Ẩn/Hiện nhanh account trên màn hình Wellcome Screen. 
Ẩn account trên màn hình Wellcome Screen 
Vào Notepad soạn nội dung sau rồi lưu lại dưới định dạng là .vbs ( 
VD: Hide Account On Welcome Screen.vbs ) 
Option Explicit 
On Error Resume Next 
Dim WSHShell, n, p, itemtype, MyBox, User, Title, Prompt 
p = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows 
NT\CurrentVersion\Winlogon\SpecialAccounts\UserList\" 
itemtype = "REG_DWORD" 
n = 0 
Prompt = "Điền tên người sử dụng muốn ẩn tại đây :" 
Title = "*•,¸.¸,•*¤*•_LuongHuuViet_•*¤*•,¸., •*" 
User = InputBox(Prompt, Title,"") 
If User = "" Then 
Title = "Error !!!" 
Prompt = "Chưa điền tên người sử dụng muốn ẩn." 
MyBox = MsgBox(Prompt,4096,Title) 
Else 
p = p & User 
Set WSHShell = WScript.CreateObject("WScript.Shell") 
WSHShell.RegWrite p, n, itemtype 
Title = "*•,¸.¸,•*¤*•_LuongHuuViet_•*¤*•,¸., •*" 
Prompt = User & " đã được ẩn trong màn hình Welcome screen." 
MyBox = MsgBox(Prompt, 4096, Title) 
End If 
Set WshShell = Nothing 
Sau đó tiến hành thực thi file vừa tạo và làm theo hướng dẫn. 
Hiện account trên màn hình Wellcome Screen 
Vào Notepad soạn nội dung sau rồi lưu lại dưới định dạng là .vbs ( 
VD: UnHide Account On Welcome Screen.vbs ) 
Option Explicit 
On Error Resume Next 
Dim WSHShell, n, p, itemtype, MyBox, User, Title, Prompt 
p = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows 
NT\CurrentVersion\Winlogon\SpecialAccounts\UserList\" 
itemtype = "REG_DWORD" 
n = 1 
Prompt = "Điền tên người sử dụng muốn hiện tại đây :" 
Title = "*•,¸.¸,•*¤*•_LuongHuuViet_•*¤*•,¸., •*" 
User = InputBox(Prompt, Title,"") 
If User = "" Then 
Title = "Error !!!" 
Prompt = "Chưa điền tên người sử dụng muốn hiện." 
MyBox = MsgBox(Prompt,4096,Title) 
Else 
p = p & User 
Set WSHShell = WScript.CreateObject("WScript.Shell") 
WSHShell.RegWrite p, n, itemtype 
Title = "*•,¸.¸,•*¤*•_LuongHuuViet_•*¤*•,¸., •*" 
Prompt = User & " đã được hiện tại màn hình Welcome screen." 
MyBox = MsgBox(Prompt, 4096, Title) 
End If 
Set WshShell = Nothing 
Sau đó cũng tiến hành thực thi file vừa tạo và làm theo hướng dẫn. 
Lưu ý: Khi lưu thành file .vbs thì chọn File  Save as… và chọn 
Unicode tại trường Encoding để hiển thị đúng phông Unicode.