Solved

windows OS: how to run script in background

Posted on 2014-04-19
5
2,183 Views
Last Modified: 2014-04-22
we are having some windows scripts with .bat extention,
by its nature when we ran those scripts,  cmd console will be kept open & listening for request  service request. incase we dont need any more, either we close console window or press CTRL+C,  to comeOut of running console window.then eventually service will stop running.

my requirement is -
how to make these script running in backgrond. just like a feature Unix, where a script can be run in background using following command
 #script.sh &

So that, no need to keep open CMD console.

we would like to know, is there any similar feature available in Windows OS.

please advice.
0
Comment
Question by:mac_g
  • 3
  • 2
5 Comments
 
LVL 15

Assisted Solution

by:ZabagaR
ZabagaR earned 500 total points
ID: 40010350
You could run it silently by calling your .bat from a small .vbs script first.  This Run method allows you to run a batch script in invisible mode. Create a .vbs file like this one. For instance save this as mytest.vbs

Put your .bat file in the below script. I used "mybat.bat" as an example. When you run mytest.vbs it will silently run mybat.bat without a dos window. You could manually run mytest.vbs or use windows task scheduler to run it automatically at a given time

After running, open windows task manager and you'll see "cmd.exe" running your process.

The .vbs script:

Set WinScriptHost = CreateObject("WScript.Shell")
WinScriptHost.Run Chr(34) & "C:\mybat.bat" & Chr(34), 0
Set WinScriptHost = Nothing
0
 

Author Comment

by:mac_g
ID: 40011005
any more advise ....
0
 
LVL 15

Assisted Solution

by:ZabagaR
ZabagaR earned 500 total points
ID: 40011385
From me? No, the above script is a good solution.
0
 

Author Comment

by:mac_g
ID: 40012112
please advice ,....

I want to run this below script..

C:\Oracle\FR\user_projects\domains\ClassicDomain\bin\startWebLogic.cmd

1) how to custmoise above your script
2) how to run this script


Thanks for your help so faar
0
 
LVL 15

Accepted Solution

by:
ZabagaR earned 500 total points
ID: 40012850
You only have to replace my sample bat file with yours.

copy and paste this text below into windows notepad. save it as weblogic.vbs
When you run/double-click it, your .cmd will run silently:


Set WinScriptHost = CreateObject("WScript.Shell")
WinScriptHost.Run Chr(34) & "C:\Oracle\FR\user_projects\domains\ClassicDomain\bin\startWebLogic.cmd" & Chr(34), 0
Set WinScriptHost = Nothing
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Event ID 29 KDC Win 2008 R2 DC 6 16
Help to debug powershell script 5 38
Cannot to SCCM site - Windows 10 5 15
Do not see remote app manager 2 11
How to record audio from input sources to your PC – connected devices, connected preamp to record vinyl discs, streaming media, that play through your audio card: Vista, Windows 7, Windows 8, Windows 8.1 and Windows 10 – both 32 bit & 64.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…

685 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