Solved

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

Posted on 2008-06-13
3
28,473 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

Do you have a plan for Continuity?

It's inevitable. People leave organizations creating a gap in your service. That's where Percona comes in.

See how Pepper.com relies on Percona to:
-Manage their database
-Guarantee data safety and protection
-Provide database expertise that is available for any situation

Question has a verified solution.

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

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
Suggested Courses

631 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