หน้าแรก

17 ต.ค. 2559

วิธีรันโปรแกรมเป็นผู้ใช้ที่ต้องการของ Windows 7/8

ผมเคยแปลกใจว่าทำไมใน Task Manager ของวินโดวส์บางโปรแกรมถึงมียูสเซอร์แตกต่างกับยูสเซอร์ที่เรารันขึ้นมาได้ แต่เมื่อเจอคำสั่งนี้แล้วทำให้กระจ่างขึ้นอีกมาก

 วิธีแรก เรียกจาก Run as different user
1. กด Shift ค้างไว้และคลิ๊กขวาที่โปรแกรม (รวมถึง ช็อตคัท, .BAT, .EXE, .MSC, .MSI) ที่ต้องการรัน จากนั้กคลิ๊กเลือก Run as different user. (ตามรูปด้านล่าง)

Run as Different User-context_menu.jpg
2. พิมพ์ user name และรหัสผ่าน ของบัญชีผู้ใช้ที่ต้องการรันเป็น
หมายเหตุ:   ถ้าบัญชีผู้ใช้อยู่บนโดเมนต้องอ้างอิงตามรูปแบบ  UserName@Domain หรือ Domain\UserName แทนที่จะใช้เพียงชื่อยูสเซอร์
Run as Different User-log-.jpg
3. อาจมีการแจ้งเตือนของ UAC ให้เลือก Yes

4. จากนั้นโปรแกรมจะรันตามยูสเซอร์ที่กำหนด

5. When done, simply close the program to stop it from running as that user.

วิธีที่สอง ใช้คำสั่ง runas ที่ command prompt
        1. ไปที่ Start -> Run พิมพ์ CMD   (ถ้าต้องการทราบวิธีใช้งานให้พิมพ์คำสั่งตามด้วย /? ตามรูป)

Run as Different User-runas.jpg

2. พิมพ์คำสั่งตามนี้และกด Enter (ดูรูปด้านล่าง)
NOTE: You would substitute USER-NAME in the command with the actual name of the user account that you want to run the program as. If the user account is on a domain, then you would use UserName@Domain or Domain\UserName for the user name instead.
runas /user:USER-NAME "C:\full\path\of\Program.exe"

ตัวอย่าง, จะรัน Notepad ด้วยยูสเซอร์ test ให้พิมพ์ตามตัวอย่าง

runas /user:test "C:\Windows\system32\notepad.exe"

Run as Different User-example.jpg
3. พิมพ์ password ของบัญชีผู้ใช้ที่ต้องการรัน

4. อาจมีการแจ้งเตือนของ UAC ให้เลือก Yes

5. จากนั้นโปรแกรมจะรันตามยูสเซอร์ที่กำหนด

การตรวจสอบ ให้รัน TaskManager 

อ้างอิง http://www.sevenforums.com/tutorials/419-run-different-user.html 


Tip   Tip    การสร้างช็อตคัท
To Create a RunAs Shortcut for the Program
OR
  • Open Notepad.
  • Type the command from step 2 above in Notepad.
  • Click on File (menu bar) and Save as in Notepad.
  • Navigate to your desktop.
  • Type in name-you-want.bat, and click on the Save button.
You will now be able to just run this shortcut or .bat file to have the program runas the user you want. 

ไม่มีความคิดเห็น:

แสดงความคิดเห็น