I'm not sure how the lock works in Windows 10, but I'd like to access the features of locking my screen after a CMD process has been executed. As the CMD window would already be running before the screen is locked, does this mean it would continue running once the screen is locked?

If not I'd be interested to know how to allow this. There are other articles that describe how to enable background apps using Windows Settings, but there is no mention of how I might accomplish this for custom apps or even a simple CMD window process.

Is it possible to lock Windows 10 while also allowing a CMD window to continue running, or does it simply keep running anyways?

  • 1
    Please refrain from asking contradicting questions within the same post. It tends to make an answer of "yes, <blah blah blah>" meaningless. Jul 21, 2020 at 1:34
  • 10
    Couldn't you figure this out for yourself with like 2 minutes of creativity? Jul 22, 2020 at 4:20

5 Answers 5


Most programs running when the computer is locked will continue to run, including command shells, like the command prompt or Powershell. It is possible for the developer of an application to detect a locked computer and perform an action, like pausing or even closing the application. However, that is generally rare, especially for a console application, as they tend to be used for servers, services, and simply outputting information. A contrary example would be a single player game, which are often programmed to detect a computer being locked and then pause the game.

  • 1
    And Netflix if you want to see it in action (even the browser based version).
    – Gizmo
    Jul 21, 2020 at 7:19
  • 9
    "will often be programmed to detect a computer locking and pause the game." Is that what they detect? I've always assumed it it was a foreground-background detection and that locking a device would put everything in the background.
    – Mast
    Jul 21, 2020 at 7:27
  • @Mast It really depends on the game. Simple focus loss is enough to pause some games, even if partially. I have some that the music continues but the game's main loop pauses. If there is no lost focus system, the game can still activate the pause screen when locked. I don't have specific examples, but I definitely have games like this as my keyboard has a lock macro on it and I sometimes hit it on accident.
    – Logarr
    Jul 21, 2020 at 13:29
  • 1
    Interestingly, the command prompt and I think also Powershell do not render updates when not in view. Because of that, some "chatty" scripts actually run faster with command prompt minimized or the screen locked.
    – Belle
    Jul 21, 2020 at 14:21
  • 2
    @belle Sort off. They still produce output and the console host process keeps track of what is supposed to be displayed. It is only the actual rendering, which is the most cpu intensive part, which is suspended until the window becomes visible again. Same happens when the window is minimized. So command prompt or powershell doesn’t actually have anything to do with it. It is the console host process.
    – Tonny
    Jul 21, 2020 at 16:45

By default, command windows continue to run while the screen is locked.

To verify this, try the following:

  • Open a command prompt window (in case you don't know how, press the Windows key, type cmd, then press enter)
  • Type ping example.com into the command prompt and press Enter to run it
  • While the ping is happening, hold the Windows key and then press the L key (this is the keyboard shortcut to lock the screen in Windows 10)
  • Wait a few moments, then unlock your screen

You should see that the ping operation continued while the screen was locked. Voila!

  • 6
    ping -t would be better, as it'll keep going until you CTRL+C it. It's also more likely to resolve, as it's a Google DNS server address. Jul 21, 2020 at 13:31
  • 1
    @spikey_richie Good to know... Jul 23, 2020 at 18:03

ALL programs in the currently logged on session will continue to run when the session is locked.

As a server and database administrator that often has to deal with moving around 100,000+ client uploaded files with RoboCopy, I do this ALL the time. I also frequently leave programs like 7Zip, WinSCP and SQL Server Management Studio running scripts/processes while the session is locked.

The keyword here is Locked, NOT Logged Off. Logging off will close all programs running in the current session.


It would continue to run, but may lose scheduling priority as it is no longer the foreground application, and the computer might suspend or hibernate when no user interaction is registered for a time.

Scheduling priority is only an issue if anything else is happening on the machine -- basically if it's the only process running, its priority doesn't matter.

So as long as your power policy will not suspend the machine when you walk away, your process will continue to run.


As an interesting note, NI TestStand timed pop-up windows do not time out during screenlock in Win10. Very annoying for automation.

  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jan 28, 2023 at 14:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .