Solved

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

Posted on 2008-06-13
3
27,617 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
[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 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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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…

734 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