1.

Solve : ms-dos copy command?

Answer» <html><body><p>Hello All, I am a newbie and I have some strange errors. One of my end users are using the dos copy command on a windows 2000 server copying to a windows 2003 server. When he copies a text file from one server to the other, some of the data is being corrupted. It normally is just 1 0r 2 characters that change. This text file is then encrypted to one of our clients but they've been complaining that we are sending them bad data. This process is normally automated and runs by itself. We may run this process 50 times and get 5 or 6 bad copies. Have anyone ever heard of anything like this, we called MS and they did not really have any answers. If the file has a "." it will be changed to a "/" or vise versa. I am at my wits in because we can not find the source of the problem. Everyone thinks its the copy command, we even substituted to the move command and it ran fine for 2 weeks and now we just found out that we have <a href="https://interviewquestions.tuteehub.com/tag/sent-1692585" style="font-weight:bold;" target="_blank" title="Click to know more about SENT">SENT</a> them another bad file. We are grasping at straws here. If anyone has a different <a href="https://interviewquestions.tuteehub.com/tag/solution-25781" style="font-weight:bold;" target="_blank" title="Click to know more about SOLUTION">SOLUTION</a> or heard of this before please let me know.<br/>This is what MS said:<br/>Brief summary of the issue<br/><br/>=====================<br/><br/>&lt;&gt; You have a job - which uses xp_cmdshell to copy a file from one folder to another (on the same server). The job uses UNC paths and not relative paths ie xp_cmdshell copy \\server\folder \\server\folder<br/><br/>&lt;&gt; Intermittently you see some characters in the file are changed - no junk characters but for some <a href="https://interviewquestions.tuteehub.com/tag/records-1180480" style="font-weight:bold;" target="_blank" title="Click to know more about RECORDS">RECORDS</a> '.' becomes '/'. You have also seen instances of some number being partially modified (<a href="https://interviewquestions.tuteehub.com/tag/2156-1730302" style="font-weight:bold;" target="_blank" title="Click to know more about 2156">2156</a> became 8156).<br/><br/>&lt;&gt; Issue is intermittent - not reproducible at will.<br/><br/>&lt;&gt; You have used ‘move’ instead of ‘copy’ and haven’t seen any issues thereafter.<br/><br/><br/><br/>Action plan<br/><br/>==========<br/><br/>If you remember one thing that we discussed was to use relative paths instead of UNC paths and see if that makes any difference ie ie xp_cmdshell copy c:\folder_name\abc.txt D:\folder_name\xyz.txt <br/><br/>Additionally I would like to run the copy command without xp_cmdshell (creating a job /batch file and schedule it using Windows task scheduler) – just to be sure that xp_cmdshell is not changing the behavior. <br/><br/>Any other suggestions will help.<br/>Thanks<br/>DoerayPlease note the ASCII representation of "." and "/" are only a bit off from one another.<br/><br/> ASCII_Char Octal Binary<br/> . 56 00101110<br/> / 57 00101111<br/><br/>Suggest you stress test the system memory of both systems using a reliable standalone memory test program such as MemTest86 (<a href="http://www.memtest86.com">www.memtest86.com</a>). A problem with memory (or the memory subsystem) <a href="https://interviewquestions.tuteehub.com/tag/could-410026" style="font-weight:bold;" target="_blank" title="Click to know more about COULD">COULD</a> modify the data passed through it.<br/><br/>You may also have to verify the integrity of the entire data path between the Windows 2000 Server to Windows 2003 Server system to see if bits are intermitently being dropped and/or added.<br/><br/>I'm assuming this isn't a DOS copy command problem.The <strong>copy</strong> command has a <strong><strong>/v</strong></strong> switch for verifying the output data is written correctly. It may slow down the copy operation.<br/><br/>Quote</p><blockquote>Additionally I would like to run the copy command without xp_cmdshell (creating a job /batch file and schedule it using Windows task scheduler)<br/></blockquote><br/>The command shell acts as the interpreter for batch files. Windows will open a command shell whenever a batch file is run, the scheduler and the run box are <em>not</em> exceptions.<br/><br/>You can however bypass the command shell by using any of the windows script languages (vbscript, jscript, rexx, python and many more)<br/><br/>The is a vbscript solution:<br/><br/>Code: <a>[Select]</a>Const FOF_CREATEPROGRESSDLG = &amp;H0&amp;<br/><br/>strTargetFolder = "D:\Scripts" <br/><br/>Set objShell = CreateObject("Shell.Application")<br/>Set objFolder = objShell.NameSpace(strTargetFolder)<br/><br/>objFolder.CopyHere "C:\Scripts\*.*", FOF_CREATEPROGRESSDLG<br/><br/>In this example, d:\scripts is the target folder and c:\scripts is the source folder. Save the script with a <strong>vbs</strong> extension and run from the command prompt as <strong>cscript <em><em>scriptname.vbs</em></em></strong><br/><br/>PS. The progress bar is built into the CopyHere method.<br/><br/><br/><br/>Note: script uses mapped drives but should work with UNC tagging also</body></html>


Discussion

No Comment Found