[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 2011-09-13
3
Medium Priority
?
396 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 2000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

OfficeMate Freezes on login or does not load after login credentials are input.
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

650 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