?
Solved

windows OS: how to run script in background

Posted on 2014-04-19
5
Medium Priority
?
2,277 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
[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
  • 3
  • 2
5 Comments
 
LVL 15

Assisted Solution

by:ZabagaR
ZabagaR earned 1500 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 1500 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 1500 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
Windows 10 Creator Update has just been released and I have it working very well on my laptop. Read below for issues, fixes and ideas.
This tutorial will walk an individual through the process of installing of Data Protection Manager on a server running Windows Server 2012 R2, including the prerequisites. Microsoft .Net 3.5 is required. To install this feature, go to Server Manager…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Suggested Courses

752 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