1

I use a .bat file as a cron.

The Windows task manager calls this batch file every 5 minutes and this batchfile simply copies a few files.

The problem is that every 5 minutes a screen with the batch output is flash on the screen. How can I prevent this batchfile shows the output on the screen?

@echo off
  copy C:\asb\APPL\BBX\WORK\pcadeau "C:\Users\Gebruiker\Dropbox\Bu_booking\" 
  copy C:\asb\APPL\BBX\WORK\pprosp "C:\Users\Gebruiker\Dropbox\Bu_booking\" 
  copy C:\Users\Gebruiker\Downloads\4* "C:\asb\APPL\SYNC\bank.csv"
  move C:\Users\Gebruiker\Downloads\4* "C:\Users\Gebruiker\Dropbox\Bu_booking\offline bank\bestanden\"
1
  • I've never managed it with a batch file. If your requirements are pretty static and you have C# coding experience you can do it with a C# program. Create a console application to do what you want then, to stop the window appearing, change the project Output Type to Windows Application. The console application still runs but produces no window. Commented May 20, 2014 at 11:23

3 Answers 3

3

As all the resources being accessed are local, run the task under the credentials of the local system account. That way the task will run in another session and you will see nothing.

Sign up to request clarification or add additional context in comments.

Comments

1

When running a batch file as a task on my Win 7 PC I add a /min to the end of the cmd.exe line. This cases the command prompt to open then immediately minimises itself.

Comments

0

I've found the solution for this myself. by simply add

>NUL

to the lines from wich you don't want output

In this example it's

copy C:\Users\Gebruiker\Downloads\4* "C:\asb\APPL\SYNC\bank.csv" >NUL
copy C:\asb\APPL\BBX\WORK\pcadeau "C:\Users\Gebruiker\Dropbox\Bu_booking\"  >NUL
copy C:\asb\APPL\BBX\WORK\pprosp "C:\Users\Gebruiker\Dropbox\Bu_booking\" >NUL 
copy C:\Users\Gebruiker\Downloads\4* "C:\asb\APPL\SYNC\bank.csv" 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.