Path to SQLCMD

Jun 7, 2011 at 5:59 PM

If you get the error message :

"" Executing sqlcmd.exe ...

Thread Threw Exception System.ComponentModel.Win32Exception: The system cannot find the file specified
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at DBSourceToolsLib.ProcessRunner.ThreadFunc() ""

You have to set the PATH environment variable for the location of the SQLCMD.EXE

 The location of the SQLCMD.EXE : C:\Program Files\Microsoft SQL Server\xxx\Tools\Binn

SQL Server 2005 ---> xxx = 90 

SQL Server 2008 ---> xxx = 100

The PATH is the system variable that your operating system uses to locate needed executables from the command line or Terminal window.


For Windows XP:

  1. Start -> Control Panel -> System -> Advanced
  2. Click on Environment Variables, under System Variables, find PATH, and click on it.
  3. In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the SQLCMD.EXE as the value.

For Windows Vista:

  1. Right click “My Computer” icon
  2. Choose “Properties” from context menu
  3. Click “Advanced” tab (“Advanced system settings” link in Vista)
  4. In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the SQLCMD.EXE as the value.