Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xcopy is not recognized as an internal or external command, operable program or batch file

Tags:

xcopy

I have a problem using 'xcopy' command.

I'm building a C# project with msbuild. At the end of the build, a batch file is called to copy my assemblies from Debug/Release to some other folders.

Here is the problem, my build fail and the error log is 'xcopy is not recognized as an internal or external command, operable program or batch file'.

The path is correctly set, xcopy do works from a windows command line and from the visual studio command line (the one set with the project environment).

I tried to set the path in the batch file but it doesn't help.

Any suggestion?

I'm using windows 7

Cheers :)

like image 712
Alk Avatar asked Jun 24 '13 10:06

Alk


People also ask

Is xcopy internal command?

'xcopy' is not recognized as an internal or external command, operable program or batch file.

How do you fix is not recognized as an internal or external command operable program or batch file?

You can resolve this issue in three ways: First, use the full path of the executable file to launch the program. Second, add the program path to Windows environment variables. Finally, move the files to the System32 folder.

Is xcopy available in Windows 10?

Xcopy Command AvailabilityThis command is available from within the Command Prompt in all Windows operating systems including Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows 98, etc. You can also access the command in MS-DOS as a DOS command.


2 Answers

I encountered the same problem.

It seems to be a problem with the path environment variable within Visual Studio.

When I added a "path" statement to the beginning of my build event, it produced the following output:

PATH= 

This seems to indicate that the path is empty within the VS build environment.

When I specify the full path to xcopy like this, the problem went away:

%systemroot%\System32\xcopy ... 

I'm not sure what caused Visual Studio to lose it's path.

like image 90
Avalanchis Avatar answered Sep 25 '22 01:09

Avalanchis


Set Environment variable PATH = %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\

like image 22
Ajit Repal Avatar answered Sep 23 '22 01:09

Ajit Repal