Solved

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

Posted on 2011-09-13
3
350 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
  • 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Robocopy questions 45 129
RDP Connection Issues 12 50
Enable Intel-VT on a IBM Yoga 7 22
Windows 7 Home Premium - not updating 3 27
I found out last night windows update has a problem regarding 4 latest updates that fail.  The way to get all 4 them installed is install sp1 first and restart then one by one with a resart in between as they fail every time if all the four updates …
First some basics on Windows 7 Backup.  It has 2 components one is a file based backup which is stored in .zip files each zip is split at around 200 Megabytes and there is the Image Backup which is as the name implies a total image of the partition …
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.
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now