views:

181

answers:

2

I'm stumped. All of a sudden Visual Studio cannot find exe files in the Windows/System32 directory (such as xcopy, attrib etc).

I have some pre-build and post-build events that execute batch files that use xcopy and attrib. Previously they were working fine but today, during the build process, Visual Studio cannot find them. The error is shown: 'xcopy' is not recognized as an internal or external command, operable program or batch file.

When I first noticed the problem I tried running xcopy in a regular cmd prompt and the same problem occurred. After I restarted my computer, the problem disappeared in the regular cmd prompt but remained in Visual Studio. After the reboot, the problem does not occur in the Visual Studio cmd prompt either - only from within Visual Studio itself.

Everything appears normal if within one of the batch files I execute set to check the PATH variable or echo %systemroot%.

In the Tools->Options menu there are settings for VisualC++ directories. However I am running C#, not C++, and besides, I never changed these settings and they appear to be correct.

Anyone had this problem before? Thoughts?

A: 

This can only be one of two things: a problem with the PATH as seen from within your batch file, or a typo in the command being run (eg., XCOPY).

%systemroot% doesn't matter too much, as XCOPY and so forth are in the SYSTEM directory (on WinXP C:\Windows\System32), and %systemroot% is the Windows directory (one level higher - again, on XP C:\Windows).

Ken White
That's what I would have thought but the batch file executes fine when I run it manually through the command line (even the VS command prompt)
cbp
A: 

This problem has resolved itself this morning after another reboot. I'm blaming it on a Windows Update or something weird performed by a rogue sys admin.

cbp