The VSPerfCmd.exe Detach option disconnects the profiler fromthe specified processes or all processes if none are specifed. Profiling must have been initialized by using the sampling method.

Profiling that was started with either the Launch or the Attach options can be disconnected with Detach. The profiler can be reattched by using subsequent Attach commands.

Detach does not close the profiling data file. Use the Shutdown option to end profiling and close the data file.

Note Note

If the Start option was specified with the Crosssession option, any calls to VSPerfCmd /Attach or to VSPerfCmd /Detach must also specify Crosssession.

VSPerfCmd.exe /Detach[:PIDs|ProcessNames]


PID - The numeric system identifer of one or more processes.

ProcessNames - the name of the process. If multiple instances of the named process are running, results are unpredictable.

Separate multiple processes with commas.

If no process is specified, the profiler is detached from all profiled process.

The following VSPerfCmd options can be combined with the Attach option on a single command line.


Enables profiling applications in sessions other than the logon session. Required if the Start option was specified with the Crosssession option.

In this example, the Detach command suspends profiling and the Shutdown command closes the profiler data file.

VSPerfCmd.exe /Start:Sample /Output:TestApp.exe.vsp
VSPerfCmd.exe /Launch:TestApp.exe
;REM Excercise the application
VSPerfCmd.exe /Detach
VSPerfCmd.exe /Shutdown