Solved

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

Posted on 2008-06-13
3
26,618 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
ID: 21781848
@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
ID: 21781864
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
ID: 21781870
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Many admins will agree: WSUS is is a nice invention but using it on the client side when updating a newly installed computer is still time consuming as you have to do several reboots and furthermore, the procedure of installing updates, rebooting an…
INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration of the Data Protection Manager product. Note that this demonstration was prepared on the basis of Windows OS is 2008 R2 and DPM 2010. DATA PROTECTI…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
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…

808 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