Solved

How do I get a scheduled task not to pop up the command window

Posted on 2011-09-13
3
384 Views
Last Modified: 2012-05-12
I am attempting to create a batch file that creates a scheduled task that runs every fifteen minutes.  It creates the task but every fifteen minutes it prompts a cmd window.  How do I get rid the task to run in the background?
0
Comment
Question by:daOracle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
joeyfaz earned 500 total points
ID: 36532840
You can make the task scheduler run a shortcut to the batch file and then configure the shortcut to run minimized or the other option is to have a vbs script execute it silently:

Set WshShell = CreateObject("WScript.Shell")
runThis=WshShell.RUN("c:\mybatch.bat", 0, True)
Set WshShell = Nothing

Then have the task scheduler execute the runthis.vbs file
0
 

Assisted Solution

by:daOracle
daOracle earned 0 total points
ID: 36537981
I have add the vbs file.  Now it says 0x1.
My batfile looks like this
schtasks.exe /create /tn "DB Maintenance Task" /xml "%dbHome%\data\db\Scripts\DBMaintenanceTask.xml" /RU "NT AUTHORITY\NETWORKSERVICE"



I verified the following:
Check Service settings :
•Open Control Panel, > Administrative Tools > Click Computer Management > Expand Services and Applications > Services.
•Right-click Task Scheduler service > Properties.
•The startup type must be automatic
•The service status must be Started
•Goto Log On tab, select local system account
•Click OK and quit everything
•Reboot the computer and check....
0
 

Author Closing Comment

by:daOracle
ID: 36558807
Awesome!  Thank you very much for you help.  I had to make the following changes to the vbscript.

Switch the network service to SYSTEM
updated the vbscript to get environment variable.
option explicit

DIM WshShell
DIM WsSystemEnv

DIM dbScrLoc

Set WshShell = CreateObject("WScript.Shell")


Set WsSystemEnv= WshShell.Environment("PROCESS")
dbScrLoc="""" & wsSystemEnv("<environment_variable name") + "data\db\Scripts\AMDWSDBMaintenance.bat" & """"
WshShell.run dbScrLoc, 0
Set WshShell = Nothing
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question