Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

windows OS: how to run script in background

Posted on 2014-04-19
5
Medium Priority
?
2,334 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

A small collection of useful tips and tricks for Windows 10 users that I decided to write as a result of recent questions that were asked and answered at Experts Exchange. Two short video tutorials included. Enjoy..
After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
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…

604 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