Tuesday, December 4, 2012

Windows 8: Log off, Restart หรือ Shut down จากหน้า Start ในคลิกเดียว

การล็อกออฟ (ไซน์เอ้าท์) รีสตาร์ท หรือปิดเครื่องคอมพิวเตอร์ Windows 8 จากหน้า Start ทำได้โดยการใช้ Charms หรือการกดปุ่ม Ctrl+Alt+Delete แต่ทั้งสองวิธีต้องทำอย่างน้อยสองขั้นตอน บทความนี้ผมมีทิปที่ช่วยให้สามารถทำคำสั่งดังกล่าวได้โดยการคลิกเม้าส์หรือแตะเพียงครั้งเดียว เป็นวิธีที่ไม่ต้องใช้โปรแกรมเสริมเพียงแต่ทำสร้างไทล์คำสั่งโดยใช้โค้ด VBScript แบบง่ายๆ เท่านั้น

สร้างไทล์สำหรับใช้ล็อกออฟ รีสตาร์ท หรือปิดเครื่องคอมพิวเตอร์ Windows 8
ในหน้าเดสก์ท็อปของ Windows 8  ให้ทำการสำเนาโค้ดด้านล่างลงในโปรแกรม Notepad จากนั้นให้บันทึกเป็นไฟล์ VBScript โดยในช่อง File name: ให้ใส่เครื่องหมายคำพูดครอบชื่อไฟล์และนามสกุลไฟล์ ตัวอย่าง "twablog.vbs" เพื่อให้ Notepad บันทึกเป็นไฟล์ VBScript (นามสกุล .vbs) แทนการบันทึกเป็นไฟล์ข้อความ (นามสกุล .txt) โดยให้เก็บไฟล์ที่สร้างไว้ในตำแหน่งที่ใช้งานได้สะดวก เช่น บนเดสก์ท็อป เป็นต้น

เริ่มโค้ด:
set WshShell = WScript.CreateObject("WScript.Shell")
strStartMenu = WshShell.SpecialFolders("StartMenu")
set oShellLink = WshShell.CreateShortcut(strStartMenu & "\Shutdown.lnk")
oShellLink.TargetPath = "%systemroot%\System32\shutdown.exe"
oShellLink.Arguments = "-s -t 0"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "%systemroot%\System32\shell32.dll,27"
oShellLink.Description = "Shutdown Computer (Power Off)"
oShellLink.WorkingDirectory = "%systemroot%\System32\"
oShellLink.Save
Set oShellLink = Nothing
set oShellLink = WshShell.CreateShortcut(strStartMenu & "\Log Off.lnk")
oShellLink.TargetPath = "%systemroot%\System32\shutdown.exe"
oShellLink.Arguments = "-l"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "%systemroot%\System32\shell32.dll,44"
oShellLink.Description = "Log Off (Switch User)"
oShellLink.WorkingDirectory = "%systemroot%\System32\"
oShellLink.Save
Set oShellLink = Nothing
set oShellLink = WshShell.CreateShortcut(strStartMenu & "\Restart.lnk")
oShellLink.TargetPath = "%systemroot%\System32\shutdown.exe"
oShellLink.Arguments = "-r -t 0"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "%systemroot%\System32\shell32.dll,176"
oShellLink.Description = "Restart Computer (Reboot)"
oShellLink.WorkingDirectory = "%systemroot%\System32\"
oShellLink.Save
Set oShellLink = Nothing
Wscript.Echo "Shutdown, Restart and Log Off buttons have been created. You can now pin them to the Start Screen of your Windows 8 computer (if they are not already there)."
จบโค้ด:

เครดิตโค้ด: xda-developers.com

หลังจากได้ไฟล์ VBScript แล้วให้ทำการดับเบิลคลิกเพื่อรันสคริปต์ซึ่งจะทำการสร้างไทล์ Log off, Restart และ Shut down บนหน้าจอ Start ของ Windows 8 ดังภาพด้านล่าง ซึ่งสามารถคลิกหรือแตะบนไทล์เหล้าที่เพื่อล็อกออฟ รีสตาร์ท หรือ ชัทดาวท์ คอมพิวเตอร์ได้ตามลำดับ


วิธีการรีสตาร์ทหรือปิดคอมพิวเตอร์ Windows 8 จากหน้าเดสก์ท็อปแบบเร่งด่วน
สำหรับวิธีการรีสตาร์ทหรือปิดเครื่องคอมพิวเตอร์ Windows 8 จากหน้าเดสก์ท็อปอย่างรวดเร็ว ทำได้โดยการใช้โปรแกรม PowerMode  (ไฟล์ดาวน์โหลดเป็น .zip) โดยหลังจากทำการติดตั้งโปรแกรม PowerMode เสร็จแล้วจะสามารถรีสตาร์ทหรือปิดคอมพิวเตอร์ Windows 8 ได้โดยการคลิกขวาบนไอคอนของโปรแกรมแล้วเลือก Restart หรือ Shutdown ตามลำดับ อ่านรายละเอียด

บทความโดย: TWA Blog

แหล่งข้อมูลอ้างอิง
Softpedia

Copyright © 2012 TWA Blog. All Rights Reserved.

0 Comment: