I have a small batch file which xcopies some files from one folder to another which I've scheduled (via windows scheduled tasks) to run every 1 hour:

@echo off
xcopy c:\foo c:\bar /E /C /F /Y

Since this is my workstation, I'm most probably doing work when the task executes, and then the black dos console window is displayed (lasts 2-3 seconds) and steals window focus.

I don't wish to see the files copied and of course the batch file does not ask for any user input. Is there a way to avoid displaying the console completely?


Check the "Run whether user is logged on or not" radio button. Even if you select the same user you're logged in as, it will start and run silently, not stealing mouse or keyboard focus. Source


You have to pass through START and CMD commands:

start "" /B "cmd /k "xcopy c:\foo c:\bar /E /C /F /Y""

Option /B tells the command interpreter not to create a new window.

  • But won’t it still display a Command Prompt window for the START command itself?It has been reported that this does not work. – Scott Sep 1 '18 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.