Problem Executing Batch File in Pre-Build Event

前端 未结 8 1405
攒了一身酷
攒了一身酷 2021-02-20 01:05

I\'m trying to execute a batch file during a pre-build event. I have a new project and have added foo.bat to it. The file contains the following line:

8条回答
  •  醉话见心
    2021-02-20 01:31

    It's possible that you have another foo.bat somewhere in the PATH. Try to specify full path to your batch file like C:\Path\to\foo.bat.

    When project is being built the current directory is the one with the .vcproj file. The command path should be specified relative to this directory, if it's not in the PATH.

    One more thing to try to diagnose the problem would be to specify cmd in the pre-build event command explicitly like this:

    cmd /c C:\Path\to\foo.bat
    

    or even

    C:\windows\system32\cmd.exe /c C:\Path\to\foo.bat
    

提交回复
热议问题