Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Lock screen after specific app quit : How to?

25 Jan 2013   #1
goja

Ultimate x86 & x64
 
 
Lock screen after specific app quit : How to?

Hello,

I need lock screen to launch right after a specific app quit. I looked in task scheduler but lack knowledge. Can i do it within or i need another app?

Thanks.


My System SpecsSystem Spec
.
25 Jan 2013   #2
Kari

Microsoft Community Contributor Award Recipient

 

This is how to do it with a batch file:
  • Locate the EXE file or shortcut of the application. I am using MsOffice Excel in this example, in my system the program EXE file is called EXCEL.EXE and it is located in C:\Program Files\Microsoft Office\Office15\ folder
  • Open Notepad
  • Type these two lines to a new text document, replacing the program or shortcut path with your program or shortcut. If using shortcut, the extension is .lnk:
    Code:
    "C:\Program Files\Microsoft Office\Office15\Excel.exe"   
    rundll32.exe user32.dll, LockWorkStation
  • Save the file to desktop selecting Save as type as All Files, remember to end your chosen filename with extension .bat:
    .
    -lock_bat.png
    (Click to enlarge.)
That's it. To run the program, Excel in this example, user now double clicks the icon of this batch file on desktop. This opens the program. As soon as user exits the program, Excel in this example, computer is locked.

Kari


My System SpecsSystem Spec
25 Jan 2013   #3
goja

Ultimate x86 & x64
 
 

Thank you!
My System SpecsSystem Spec
.

25 Jan 2013   #4
Kari

Microsoft Community Contributor Award Recipient

 

You are welcome!
My System SpecsSystem Spec
26 Jan 2013   #5
goja

Ultimate x86 & x64
 
 

Unfortunatly that won't do for me : i wanted to use for a screensaver that can't be used normally (incompatibility on x64 systems..) but it i input the screensaver location it will launch.. its settings! And if i make a shortcut of it, it'll directly go to lock screen (tried with jpg file instead, same, doesn't launch, direct lock screen)
My System SpecsSystem Spec
27 Jan 2013   #6
Kari

Microsoft Community Contributor Award Recipient

 

Quote   Quote: Originally Posted by goja View Post
Unfortunatly that won't do for me
The batch file I told you how to create works without issues. It launches a program and after the program is finished goes to lock screen. The batch works perfectly.

If you have problems to get your programs to work, it has nothing to do with this batch file. Start a new thread and ask help. Notice that there's no way to get a program to work on x64 system if the maker tells it's not x64 compatible.

Kari
My System SpecsSystem Spec
27 Jan 2013   #7
goja

Ultimate x86 & x64
 
 

Sorry but no. The app itself launch, but it I use the bay it directly went to lock screen.. I will try again but well..
My System SpecsSystem Spec
27 Jan 2013   #8
Kari

Microsoft Community Contributor Award Recipient

 

Quote   Quote: Originally Posted by goja View Post
Sorry but no.
Sorry but yes.

If it went direct to lock screen using the batch file, it means that the app shuts itself down. The batch works, it only goes to lock screen when the app is closed (shut down).

Kari
My System SpecsSystem Spec
27 Jan 2013   #9
goja

Ultimate x86 & x64
 
 

Try it with any screensaver (making a shortcut if it) and tell me what happens.
My System SpecsSystem Spec
27 Jan 2013   #10
Kari

Microsoft Community Contributor Award Recipient

 

Quote   Quote: Originally Posted by goja View Post
Try it with any screensaver (making a shortcut if it) and tell me what happens.
Of course it does not work with screensavers! It works with programs and applications. A screensaver (.scr file) is not a normal application per se; the lock screen command in batch file is as "exit" command for a screensaver so it shuts down and proceeds to lock screen.

If you want to automatically go to lock screen after screensaver has closed (mouse movement or keyboard press), you need to set the highlighted option on screensaver settings:

Name:  Screen Saver Settings.png
Views: 2
Size:  14.2 KB

Kari


My System SpecsSystem Spec
Reply

 Lock screen after specific app quit : How to?




Thread Tools





Similar help and support threads
Thread Forum
Num Lock, Caps Lock and Scroll Lock all lights up (not blinking)
For some time now, i have been experiencing that my Num Lock, Caps Lock and Scroll Lock all lights up (not blinking) all at the same time, I tried to google it but i can not find any solutions or explanations for it. Does anyone know if it is bad? and what is causing this? I am having a wired...
Hardware & Devices
Caps Lock/Num Lock, on screen pop up gone Gateway NV77
Good afternoon, I just did a clean install of 7 to fix errors with my laptop, and it fixed one, but not the other main issues, My caps lock, and number lock button on the keyboard don't have a light on it and the pop up that is supposed to pop up doesn't show up on screen. I figured by doing...
General Discussion
Screen lock up.
Ok, i got a lil problem with my computer. When i go on certain websites, or start up Origin when i wanna play BF3, my screen lock up for a few seconds. The sounds hold up some times, and starts again when the screen is working again. It has been like this for a while. And i upgraded my computer...
Performance & Maintenance
Application specific lock ups.
I have been trying to diagnose a particular problem where applications freeze for a split 2-3 seconds at random intervals. I really hope that someone might be able to provide some suggestions as I am starting to pull my hair out with this. For example, I could be running the following programs:...
Software
Caps lock, num lock, scroll lock screen messages
Hi, how to disable Caps lock, num lock, scroll lock screen messages? I have desktop pc with two keyboards usb and bluetooth. Also TOSHIBA Bluetooth Stack software, but in device manager: keyboard > hid keyboard device both using microsoft drivers. And I dont have any software installed...
General Discussion
Lock Screen
Hello everybody, I was recently poking about in the Group Policy Editor seeing if there were any changes between Vista and 7, but after I had exited and locked my computer I noticed my lock screen now shows as this: http://img121.imageshack.us/img121/2/20092009100o.jpg (I had to use my phone...
General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 04:05.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App