I produce HTML pages for my web site using various batch files. For some reason on the bottom of several pages, there is a special character (at least, that is what it seems to be to me) that looks like a thin line with a small arrow pointing to the right. I would paste the character on this post, but it doesn't copy into this window. On some text editors, the character appears as "^Z", minus the quotation marks.
I believe the character is a line feed break, or a new line delimiter of some kind, because the effect it has on my web pages is to add a blank line at the bottom of the page. The character can be deleted easily enough by hand, but when I try to remove it using any of the command-line search-and-replace batch tools I use, the command line argument halts as soon as the special character is encountered. To be more clear, this is the command line argument (the character is represented in the command line by the "+" symbol, and you can see it toward the end of the CL argument)
"C:\Programs\fnr\fnr.exe" --cl --silent --dir "C:\macros\trades\html" --fileMask "*.html" --excludeFileMask "*.dll, *.exe" --caseSensitive --find "+" --replace ""
I'm basically trying to remove the special character and replace it with nothing; in effect, deleting it altogether. But, I can't do it, because the CL argument stops as soon as the special character occurs. I believe the character has the same effect as hitting the enter key, because the error message I get is this:
" --replace "" is not recognized as an external or internal command.
Those are the words right after the special character, so obviously the character has stopped the CL program dead in its tracks and tries to continue on with a perceived command that is nothing more than a fragment of the command line argument.
I've tried using an escape character, namely, ^, to try and stop the command prompt from interpreting the character as a special command, but I've not had any luck.
Any thoughts on what I can do to make the command line argument work in this case? I would think there would be some way that I could make the special character be perceived in the command window as a regular character, but so far I'm at a loss.
Thanks in advance for any help.
Special character is befuddling my batch file
Moderator: DosItHelp
Re: Special character is befuddling my batch file
^Z is an EOF character. This might help:
viewtopic.php?p=32468#p32468
Saso
viewtopic.php?p=32468#p32468
Code: Select all
copy /a file.txt out_file.txt /b
Saso
Re: Special character is befuddling my batch file
Would help to see your batch file. We really can't tell you why it is happening without seeing it. We are not omniscient but this topic has been covered on the forums in the past.
Re: Special character is befuddling my batch file
The control Z is often appended by a copy command.
Assuming you have control of the batch file then you can use binary mode with the copy command by adding the /B switch and the ^Z/EOF character will not be added.
Assuming you have control of the batch file then you can use binary mode with the copy command by adding the /B switch and the ^Z/EOF character will not be added.
Re: Special character is befuddling my batch file
Yep, problem solved. As usual, you guys provided me the necessary insight to solve the problem almost instantly. The problem was with a comspec command that I was using in a VBA script to build my web pages. For instance, the comspec line that I had been using was this, which basically merged together several text files into an .HMTL page:
Shell Environ$("COMSPEC") & " /c Copy C:\macros\trades\html\*.txt C:\macros\trades\html\transactions.html "
That turned out to be what was adding the EOF character. So, thanks to the suggestions by foxidrive and miskox, I simply added the binary mode switch (/b) to the comspec line, like so:
Shell Environ$("COMSPEC") & " /c Copy C:\macros\trades\html\*.txt /b C:\macros\trades\html\transactions.html "
. . . and the problem is completely solved. No more EOF character any more.
Squashman, sorry to have not posted the entire batch file. For simplicity's sake, I was trying to isolate the problem on one particular line of code, and as it turned out, the code that I provided was not where the problem existed. So your point is well-taken about posting the file in its entirety.
Thanks again to all of you for taking the time to address - and solve - my issue.
Shell Environ$("COMSPEC") & " /c Copy C:\macros\trades\html\*.txt C:\macros\trades\html\transactions.html "
That turned out to be what was adding the EOF character. So, thanks to the suggestions by foxidrive and miskox, I simply added the binary mode switch (/b) to the comspec line, like so:
Shell Environ$("COMSPEC") & " /c Copy C:\macros\trades\html\*.txt /b C:\macros\trades\html\transactions.html "
. . . and the problem is completely solved. No more EOF character any more.
Squashman, sorry to have not posted the entire batch file. For simplicity's sake, I was trying to isolate the problem on one particular line of code, and as it turned out, the code that I provided was not where the problem existed. So your point is well-taken about posting the file in its entirety.
Thanks again to all of you for taking the time to address - and solve - my issue.