Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

All,

I have an interesting problem that I have looked everywhere for an answer and have come up short. Hopefully someone out there can shed some light as to why this is happening.

I have a CD that contains several C++ applications and a batch file that is ran to copy the files to the correct spots using XCOPY. Yes the xcopy operation happens successfully and the new applications are put in the correct spots.

The problem I am having is right after the batch file has finished copying the file over, I close the batch file window, eject the CD, and run any of the newly copied applications from its new location on the computer. I get the Windows error "There Is No Disk in the Drive. Please Insert a Disk into Drive D:". (That is my CD drive's name)

My programs do NOT have any references to any hardcoded/relative paths at all. In fact, once I acknowledge this error 4 or 5 times and reopen the program, I NEVER see the error again. To see the error pop back up again, I have to run the batch file again from the CD and take the CD out before I run the application.

Just for more clarification, doing a manual copy/paste (Ctrl+c, Ctrl+v) of an application from the disk works just fine. If I manually copy/paste and eject the CD, the program works just fine. This error only occurs on the first time the program runs after I copy it over with a batch file and remove the CD before I run the program. Also, restarting the computer after the batch file is ran prevents this problem from happening altogether too.

I know what you are saying, if restarting the computer after copying the file over fixes the problem, then why is he asking this question here? Well, I have to copy this file on 30+ non-networked computers at a time and it takes a LONG time to restart each of them.

Is there some weird Windows tagging of the applications when they are copied over with XCOPY to where the program still thinks it lives on the CD after being copied over? Does anyone have any suggestions, comments, or links that can point me in the right direction? Any help would be phenominal.

Thanks a lot!

EDIT: I forgot to mention that this is on the Windows XP operating system.

EDIT2: Here is the code for my batch file.


@ECHO OFF

SET INSTALLSERVER=%~dp0
SET AppProgramFiles=%ProgramFiles%\ApplicationName\

XCOPY "%INSTALLSERVER%Scenario\*.*" "%AppProgramFiles%Scenario\" /C /Y /q
XCOPY "%INSTALLSERVER%Plan\*.*" "%AppProgramFiles%Plan\" /C /Y /q
XCOPY "%INSTALLSERVER%Data" "%AppProgramFiles%Data\" /C /Y /q /e
XCOPY "%INSTALLSERVER%Misc\*.*" "%AppProgramFiles%Misc\" /C /Y /q


As I mentioned above, I can copy/paste the application myself and the program runs just fine. There is NO error if I do it this way. The "No disk in the drive" error ONLY shows up if I copy the application over using a batch file. In fact, I've seen the same problem if I copy an application over using a vbscript file as well. I'm wondering if Windows XP has some strange way of tagging applications that get copied off of a CD using a process like batch/vbscript? Any ideas?

share|improve this question

migrated from stackoverflow.com Jun 5 '13 at 23:25

This question came from our site for professional and enthusiast programmers.

    
This really isn't a programming or programmers tools related question, and is more suited for Super User; it'll probably be closed here. You might try using the /J switch for xcopy, which causes it to use unbuffered file I/O. Type help xcopy at the command prompt for more info. –  Ken White Jun 5 '13 at 22:39
    
Ken: I forgot to mention that this is being done on XP machines. The /J switch for XCOPY doesn't exist for that and that is my fault for not mentioning it earlier. My goal for my question was just to see if anyone in their programming experience ever ran across this problem and what they did to fix it? I have never heard of the Super User site that you posted, but if I don't find my answer here I will definitely go take a look at it. Thank you very much. –  Doug Jun 5 '13 at 22:55
    
StackOverflow is restricted to programming and programmers tools questions (see the faq and tour pages, and "How do I copy files from a CD using XCopy?" doesn't fit into either of those categories. :-) As I said, your question will probably be closed here. –  Ken White Jun 5 '13 at 23:17
    
Looks like there is some initial 'current/default drive/folder' in either the batch file or the programs. From "My programs do NOT have any reference..." can I conclude that you wrote the programs? If so, what initialization code is accessing drives/folders? Also, I suggest you edit your question to show the batch file. Having said all that, it may really be a SO question after all ;-) –  Jan Doggen Jun 6 '13 at 7:28
    
Jan: Thank you for the suggestion, I have added the batch file code to the post. I really do not think this is a problem with the applications themselves. As I said above, I can copy an application off of the disk manually, pop the disk out, and the application runs just fine. The problem ONLY pops up after I copy an application off of the disk using a batch/vbscript file, pop the disk out, and immediately try to run the program. There has to be something that Windows is doing that hopefully someone with more knowledge of Windows than what I have can answer. –  Doug Jun 6 '13 at 19:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.