I have find a easy to lock the windows by writing a batch file. And the batch file contains only two line as follow,
lock.bat
@echo off
rundll32.exe user32.dll,LockWorkStation
one thing I want to inform is that the lock.bat must have excutive attribute.
To make it easy to use, I suggest you put the lock.bat file to the desktop, and when you want to lock the computer, you just have to double click the batch file, and everything will be done for you.
[this batch file has been tested on Windows XP professional edition with sp2]
And also you can write a batch file to shutdown the windows as follow,
shutdown.bat
@echo off
rundll32.exe user32.dll,ExitWindows
or
shutdown.bat - this batch file can only be run on windows XP or later version
@echo off
shutdown -s -f -t 00
lock.bat
@echo off
rundll32.exe user32.dll,LockWorkStation
one thing I want to inform is that the lock.bat must have excutive attribute.
To make it easy to use, I suggest you put the lock.bat file to the desktop, and when you want to lock the computer, you just have to double click the batch file, and everything will be done for you.
[this batch file has been tested on Windows XP professional edition with sp2]
And also you can write a batch file to shutdown the windows as follow,
shutdown.bat
@echo off
rundll32.exe user32.dll,ExitWindows
or
shutdown.bat - this batch file can only be run on windows XP or later version
@echo off
shutdown -s -f -t 00