How to run an interactive batch file on windows from a service?

Windows Batch File - Run Minimized?

  • I've a batch file for automatically uploading a file from my computer to my webspace. The batch file does it's job perfectly but I'm having problems automating the running of the batch file. I've set up a scheduled task to run the file but the problem is that even with the batch file settings changed to 'Run Minimized' the scheduled task still runs maximised and takes over my whole screen. Since I have the file set to run every 10 minutes this is a problem. Anybody have any solutions?

  • Answer:

    The scheduled task "sees through" the shortcut if you create it using "Browse". If you edit your task to point to the actual shortcut, which ends in ".lnk", then it'll work. The ".lnk" part of the shortcut's name is hidden by the window manager, but if your file is "test.bat", your shortcut would be called something like "Shortcut to test.bat.lnk" More http://robert.accettura.com/archives/2003/10/29/background-batch-file/#comment-1191: "I got it to work. Simply create a shortcut to the bat file in the same directory which will create a .lnk file. Go to the properties of the lnk file and set it to run minimized. Then, go to the scheduled task and “manually” enter the path+file name of the .lnk file. If you click browse to search for the lnk file, it won’t work."

daveirl at Ask.Metafilter.Com Visit the source

Was this solution helpful to you?

Other answers

Create a shortcut to the batch file, set the screen settings in there, schedule the shortcut.

krisjohn

I thought that would work but it doesn't appear to. I think the scheduled tasks just 'sees through' the shortcut to the batch file it's pointing to.

daveirl

I don't suppose you would be willing to share that batch file would you? That sounds pretty handy. I am assuming you are using FTP in the file to upload those files? If you edit out the login info then I won't see any sensitive info. Thanks

SparkyPine

First you save a file with the ftp commands you want to use e.g. in my case the following: open my.webserver.ie username password cd davesrants.com/azureus/ prompt mput azureus_stats.xml bye Then, you simply create a batch file with the following command. 'azupdate.txt' is the name of the set of commands I wrote out above. cd C:\Documents and Settings\Dave\My Documents\ ftp -s:azupdate.txt

daveirl

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.