Partager via


Automating processes and tasks

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

Automating processes and tasks

  • Using the Windows interface

  • Using command-line tools

Using the Windows interface

The following table lists some of the most common tasks for automating processes and tasks, and the tools you can use to perform them. For more information, click the corresponding link under Tool or Feature.

Task Tool or feature

Automate routine or repetitive tasks.

Using batch files

Assign scripts to define settings for a group of users.

Group Policy (pre-GPMC)

Assign tasks that will be performed whenever a user logs on to a particular computer, such as mapping network drivers, starting background processes, and initializing user environment variables.

Logon Scripts

Run a group of commands in batch mode against a specified computer; save a configuration script in a text file for archival purposes, or to help you configure other computers.

Netsh overview

Schedule any script, program or document to run at a scheduled time.

Task Scheduler

Write a management script or batch file to automate administrative tasks.

Windows Management Instrumentation Command-line

Run scripts by clicking a script file on the Windows desktop or by typing the name of a script file at the command prompt.

Windows Script Host

Synchronize time on the computers in your network.

Windows Time Service

For more information about automating installations, see "Automating and Customizing Installations" at the Microsoft Windows Resource Kits Web site.

For more information about creating and using scripts, see the "System Administration Scripting Guide" at the Microsoft Windows Resource Kits Web site.

Using command-line tools

The following table lists some of the most common tasks for automating processes and tasks, and the command-line tools you can use to perform them. For more information, click the corresponding link under Command-line tool.

Task Command-line tool

Call one batch program from another without stopping the parent batch program.

Call

Choose from among a set of user option keys such as Yes, No and Continue in a batch program.

Choice

Redirect command output from the command line to the Clipboard.

Clip

Recalls commands, edits command lines, and creates macros.

Doskey

End localization of environment changes in a batch file, restoring environment variables to their values before the matching setlocal command.

Endlocal

Create a custom event in a specified event log.

Eventcreate

List the events and event properties from one or more event logs.

Eventquery.vbs

Display and configure event triggers on local or remote computers.

Eventtriggers

Exit the current batch script or the Cmd.exe program (that is, the command interpreter) and return to the program that started Cmd.exe or to the Program Manager.

Exit

Run a specified command for each file in a set of files.

For

Select files in a folder or tree for batch processing.

Forfiles

Set the system environment variable %ERRORLEVEL% to the value associated with the specified Windows operating system.

Gettype

Within a batch program, directs the operating system to a label; The operating system then processes the commands that begin on the next line.

Goto

Perform conditional processing in batch programs.

If

Sets the command path in the PATH environment variable, which is the set of directories used to search for executable files. Used without parameters, path displays the current command path.

Path

Suspend the processing of a batch program and display a message that prompts the user to press any key to continue.

Pause

Change the current directory to the directory stored by the pushd command.

Popd

Store the name of the current directory for use by the popd command before changing the current directory to the specified directory.

Pushd

Include comments (remarks) in a batch file or in your configuration files.

Rem

Communicate with the Service Controller and installed services; retrieve or set control information about services.

SC

Schedule commands and programs to run periodically or at a specific time; manage the Task Scheduler service

Schtasks

Display, set, or remove environment variables.

Set

Start localization of environment variables in a batch file.

Setlocal

Set environment variables in the local or system environment, without requiring programming or scripting.

Setx

Change the position of batch parameters in a batch file.

Shift

Pause the command processor for the specified number of seconds. Timeout is typically used in batch files.

Timeout

Diagnose problems occuring with Windows Time.

W32tm

Synchronize multiple computers across a network.

waitfor

Locate and display all files that match the given parameter; by default, the search is done along the current directory and in the PATH environment variable.

Where

For more information about the command shell, see Command shell overview. For information about tools used to manage the command-prompt window, see Manage the command-prompt window. For an alphabetical list of all of the command-line tools, see Command-line reference A-Z.