Solved

"batch files" "silent mode" "@echo off"

Posted on 2008-06-13
3
25,171 Views
Last Modified: 2013-12-04
I am trying to suppress the dos window that appears when a batch file runs. I take care of about 50 public workstations and I want a batch file to run when the user logs in but I don't want them to be able to see it. What has been happening is the batch file starts but the user closes it before the batch finishes and so the task is not completed. I've tried @echo off but this doesn't seem to do anything.
0
Comment
Question by:notcjw
3 Comments
 
LVL 31

Accepted Solution

by:
Frosty555 earned 90 total points
Comment Utility
@echo off will just prevent the batch file from outputting the lines it is executing to the console. The window will still show no matter what because the batch file has to run from within a command window.

Try starting it using the START statement, passing it the /MIN parameter so that it starts minimized. At least that way it doesn't appear right in the user's face.
start /min %comspec% /c yourbatchfile.bat

Open in new window

0
 
LVL 3

Assisted Solution

by:gs121
gs121 earned 80 total points
Comment Utility
I found this..

To have an MS-DOS Batch file run in a hidden window:

In these circumstances, there is no MS-DOS window, nor any
corresponding Taskbar button, so the Batch Code should begin
@ECHO OFF and end with CLS and/or EXIT, or the process may
stall invisibly.

For example, if the Batch file to be run in a hidden window
is named C:\WORK\MYBATCH.BAT, create the following .VBS file:

====Begin cut-and-paste (omit this line)
CreateObject("Wscript.Shell").Run "C:\WORK\MYBATCH.BAT",0

====End cut-and-paste (omit this line)

Requires Windows Script Host installed. Double-click or otherwise
execute the .VBS file, for example, with the START command:

start MyFile.VBS

to run the Batch file invisibly.

http://fixunix.com/ms-dos/23183-running-batch-file-without-command-prompt-window.html
0
 
LVL 6

Assisted Solution

by:rcastle
rcastle earned 80 total points
Comment Utility
Try this:

http://www.computerhope.com/dutil.htm

or another way:

The coolest way is to make the batch file run totally
invisibly. This is just a little dangerous because your
batch file MUST be able to close itself and MUST never
produce an error which might require user input.
Otherwise the batch file will hang invisibly until
system shutdown or until someone kills it with the task
manager. To do this trick REQUIRES that you have Windows
Scripting installed. Scripting is standard on Win98 and
newer, and is an optional free download for Win95. To
test, type "wscript" in the Start/Run dialog. If you get
a settings dialog, you have it. If you get an error or
Windows offers to find it for you, you don't have it.
See my scripting web page for more info:
http://www.ericphelps.com/scripting/index.htm
Save this one line of text as "invisible.vbs":
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
To run any program or batch file invisibly, use it like this:
wscript.exe "C:\Wherever\invisible.vbs" "C:\Some Other Place\MyBatchFile.bat"
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

The way I use Experts Exchange to assist me in analyzing and diagnosing a problem is I first enter a Verbose Question at Experts Exchange like: Office 2007 will hang when opening and saving files I then launch WordPad (any text editor will do) an…
Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
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…

743 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

10 Experts available now in Live!

Get 1:1 Help Now