I have an error message when I put a command like "echo test2" in Post-build event command line as attached.
The command works in DOS command as shown 
I have an error message when I put a command like "echo test2" in Post-build event command line as attached.
The command works in DOS command as shown 
Hi @KeyhoonKo-6110 ,
Welcome to Microsoft Q&A forum.
Tested on my side, but failed to reproduce your issue, the echo test2 post-build event worked on my side.
Generally, this command should work. I suggest you check these aspects:
1). Rebuild your solution.
2). Change the Run the post-build event from On successful build to Always and then rebuild your project.
3). Please switch to check the Output window to see the detailed error message(Tools > Options > Projects and Solutions > Build And Run > MSBuild project build out verbosity: > Detailed/Diagnostic > OK).
4). Perhaps this error is caused by specific development environment, if this issue is reproducible(by using a new project), please share the steps with me to reproduce your issue.
Best Regards,
Tianyu
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Tianyu,
Thank you for your quick response.
I created a new win form application, and add post-bult with "Always" for Run the post-build event option as you recommended 2).
I captured the Output window with your suggestion of 3).
The highlighted Korean says
"C:\Users\=====" is not an internal or external command, executable or batch file.
However, I found my user path includes "(----)" as shown attached.


Hi @KeyhoonKo-6110 , thanks for the detailed information. Still, I can’t reproduce your issue. I wonder 1). did you change some settings of VS? 2). Did you set/modify/add the environment/system variable? 3). Did you install some extensions? 4). Could you please share me the snippets of your .csproj file?
TTianyu,
I can't remember if I changed any settings, environment/system variables/extensions.
II created a project and just added post-build events.
I attached csproj file after changed its extension to log.
[1]: /answers/storage/attachments/119138-windowsformsapplication1.log
Hi @KeyhoonKo-6110 , I tested with the proj file that you provided and even changed to use Korean, it passed on my side. Please check if the C:\windows\system32 environment variable has been set on your machine. And try to repair VS from VS Installer.
Tianyu,
Thank you for your support.
I tried VS repair, but it doesn't work.
Please see the attached image which shows system environment variables.
Hi @KeyhoonKo-6110 , yes, the system environment variables are set well. Try this: reset VS settings, in VS > Tools > Import and Export Settings… > Reset all settings > select “No, just reset settings, overwriting my current settings > choose General > Finish”.
Besides, you can also try to start VS under safe mode, and this will avoid the other extensions’ impact, but may not work for WinForm project, as some components will not be loaded.
10 people are following this question.