cancel
Showing results for 
Search instead for 
Did you mean: 

(Helpful Tip) When Copying MHT files, use Copy /B (Binary) or else they might get 'corrupted'

Highlighted
Senior Member

(Helpful Tip) When Copying MHT files, use Copy /B (Binary) or else they might get 'corrupted'

Just ran into an issue that brought me down a very long rabbit hole almost all day and figured I would post it here just in case.

I have a Jenkins Job that runs tests through the "TestComplete Test" plugin on a daily basis.

Right now I have it as a Freestyle job so I don't have the MHT file going to a specific folder (through Pipeline Jobs).

So, I'm running another Freestyle Job at the end that does a "copy" from the build folder to the Logs Archive folder.

 

The issue started showing itself by not letting me open the MHT file (the copy) and saying "This page can't be displayed'PageCannotBeDisplayed.PNG

Of course, I start searching Google, SmartBear forums, anywhere I can and I find quite a few results but the steps vary wildly.

https://community.smartbear.com/t5/TestComplete-General-Discussions/mht-file-shows-no-information/m-...

https://answers.microsoft.com/en-us/ie/forum/ie8-windows_other/unable-to-view-mht-files-on-local-dri...

There are plenty of more links I could give out from my search history, but that's, not the point. The point was I tried everything from changing my AxtiveX settings to changing my compatibility settings, to reinstalling TestExecute and TestComplete. A lot of going nowhere.

I had opened the original (in the builds folder for Jenkins) and realized it was fine so I narrowed it down to the copy.

Even though you can't read much when you open an MHT file in a text editor, I decided to do a file compare to see if I could see anything.

SubCharacterEnd.PNG

 

There was a SUB character at the end of the corrupted file. I had no idea how that got there so I did some more digging and found something about Copy

https://stackoverflow.com/questions/6313960/an-arrow-%E2%86%92-character-getting-appeded-to-files-in...

 

The arrow is a CTRL-Z ascii char that is appended by the COPY command when used to concatenate files with the + option.

To prevent COPY to append the CTRL-Z character, use COPY /B for a binary copy.

Even though this is for concatenating files (and I wasn't), the point is COPY /B should be used to prevent this from happening.

I know this isn't specifically related to TestComplete, but I really hope I can save 1 person out there from wasting half a day trying to figure out this issue. Getting lost down a rabbit hole that has nothing to do with your issue, in the end, can be really frustrating.

Happy Automating friends Smiley Happy

 

 

1 REPLY 1
Community Manager

Re: (Helpful Tip) When Copying MHT files, use Copy /B (Binary) or else they might get 'corrupted'

Hi @AndrewTWill,

 

I'm sure it will help someone in the future! Thanks for sharing the solution you've found.

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
New Here?
Join us and watch the welcome video: