Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch file scripting

Status
Not open for further replies.

KyoAD

Technical User
Aug 5, 2002
106
0
0
SG
Hi,

I am trying to use dos batch file to create my scripts. Is there a way to hide the actions that i am running in the background when the script is running? I have echo off and say for eg, i wanted to copy certain files, i do not want the copying process to show on the screen.

Thanks!
 
How are the dos batch files launched ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Initially i was thinking to use as logon scripts, meaning to be launched in Windows. However, i have another special requirements to launch them in DOS instead (network booting). Is there a way to suppress these??
 
The line in your batch file that does the copy should end with...

> nul

This redirects the output from the console to the infinite etherspace, so the results of the command are not shown on screen.
 
You also want to use ECHO OFF command to hide what commands are being run. Prefix with @ to suppress the "ECHO OFF" from being displayed when the script is run. You can prefix any command with @ to hide it at execution.

You can use the > and >> to push the default output to a file or device. "nul" will make the output go into oblivion. But you can log output to files. The single > creates a new file (will overwrite existing files). The double >> will append the output to an existing file (creating a new file if the output file does not exist).

Create a .CMD (NT, 2000, XP) or .BAT (95, 98, Me) file with the following and run it a couple times to see how each of these work.

Code:
@REM Comment won't display
ECHO This line will show up and the command as well.
@ECHO Only the echo will show up, the command will be silent
@ECHO OFF
REM This command will be silent because of the ECHO OFF above.
DIR > newfile.txt
DIR >> appendfile.txt


Nathan aka: zaz (zaznet)
zaz@zaz.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top