Utility: Command line

Last Update: 9/26/2016

Team Services | TFS 2017 | TFS 2015 | Previous versions (XAML builds)

Run a program from the command prompt.

Demands

None

Arguments

Argument Description
Tool

Specify the tool you want to run.

If you are using an on-premises agent, in most cases you should configure the machine so that the tool is on the PATH enviornment variable. But if you know the location of the tool, you can specify a fully qualified path.

Arguments Specify arguments to pass to the tool.
Advanced
Working folder Specify the working directory in which you want to run the command. If you leave it empty, the working directory is $(Build.SourcesDirectory).
Fail on standard error Select this check box if you want the build to fail if errors are written to the StandardError stream.
Control options

Example

On the Build tab of a build definition, add these steps:


Utility: Command Line

Get the date.

  • Tool: date
  • Arguments: /t

Utility: Command Line

Display the operating system version.

  • Tool: ver

Utility: Command Line

Display the environment variables.

  • Tool: set

Utility: Command Line

Display all files in all the folders created by the build definition.

  • Tool: dir
  • Arguments: /s
  • Advanced, Working folder: $(Agent.BuildDirectory)

Q&A

Where can I learn Windows commands?

An A-Z Index of the Windows CMD command line

Do I need a build agent?

You need at least one agent to run your build. Get an agent.

I can't select a default agent queue and I can't queue my build. How do I fix this?

See queues.

I use Team Foundation Server on-premises and I don't see some of these features. Why not?

Some of these features are available only on Visual Studio Team Services and not yet available on-premises. Some features are available on-premises if you have upgraded to the latest version of TFS.