Reputation: 4078
No matter what my code is, even if my batch file is syntactically incorrect, even if it is absolutely correct and even if there is nothing to display on the screen the batch file when executed just displays the code as it is.
I read a similar question MSDOS prints the whole batch file on screen instead of executing but since that was on MS-DOS I hoped my issue could have a solution different than that.
Eg,
@echo off
set abcd=4
Even its batch file would just display the same lines as it is. Please help.
Upvotes: 2
Views: 2892
Reputation: 11
Check the file with an editor that allows you to see the encoding. For example Notepad++ , you will see is very different the end of line via CF (\r) and LF (\n)
Your CMD can be recognizing EOL via \n only.
Upvotes: 1
Reputation:
Try "resetting" cmd if possible. U can try copying someone else's "cmd.exe" and replace it with yours using another bootable OS as windows wont allow that.
Here use my cmd.exe. https://drive.google.com/open?id=0B6ghonMKBfUSLVpRV0U5bG5pQTQ Just in case u need to know I am using Windows 10 64 bit.
Upvotes: 0
Reputation: 193
Perhaps there is a problem with your environment variables. Check the following:
Upvotes: 0
Reputation: 540
To determine whether your issue is really with line breaks being converted by your text editor (as the post you mention suggests), perform the following test:
.
Echo Off
Set abcd=4
Echo abcd
Now type Test to run the batch file. If it runs properly, it means you are indeed dealing with line termination issues. Use a different text editor (don't use Notepad!!!), ideally one where you have an option to display the line termination characters (I personnally use NotePad++, it works great for these kinds of things but there are many others out there).
Upvotes: 1