Subscribe to Windows IT Pro
June 01, 2004 12:00 AM

JSI Tip 8097. Enclosing a set of commands in parenthesis () simplifies some batch files?

Windows IT Pro
InstantDoc ID #81004
Rating: (1)

Enclosing a set of commands in parenthesis () groups them together.

Example:

If your batch contains a set of commands like:
@echo First line of new file>"%TEMP%\FileName.tmp"
CD C:\FolderName
@echo Folder is %CD%>>"%TEMP%\FileName.tmp"
dir /b>>"%TEMP%\FileName.tmp"

Then, using parenthesis results in a simpler construct:

(
 @echo First line of new file
 cd C:\FolderName
 @echo Folder is %CD%
 dir /b
) >"%TEMP%\FileName.tmp"



Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.