Temporarily disable serial connection

Hello all, I come travelling from the great Northlands to seek assistance in a matter of programming. For reasons that only a Doctor of Wizardy could understand I need to have the serial connection temporarily disabled so that in the computers eye the device is no longer connected. So, can this be down without powering down the device, or have the device lose power, but pick up where it left off instead of starting the code over?

Which end of the connection is going to decide that the connection doesn't exist?

I feel some more context would be helpful. The idea is to use a vbscript to identify the comport number in use by the device. So the vbscript runs mode.com on the command line then the devices is disabled and the mode.com is run again, and then the device is re-enabled at (hopefully) the same point in the code. The two text files produced are cross referenced and the only entry that doesn't appear in both should be the device in use. From there I can use a regex in VB to find the number. Once I have the COM port number the remainder of the VBscript can run, and send target information to the device where it will be saved to an awaiting SD card.

I have everything working (saving the needed info to the SD card, automated generation of the VBscript, and sending the data) the only thing I can't figure out how to do is find the COM port number in use. So is this at all possible to achieve by attempting to have the device disable itself so the computer doesn't see it anymore?

So is this at all possible to achieve by attempting to have the device disable itself so the computer doesn't see it anymore?

I can't see how. How would the Arduino know to end serial communication with the PC?

A far better solution is to have the PC send something to the port, and see if it gets the expected response. The Arduino would, of course, have to provide the correct response.

I can't help but think, though, that it would be simpler to plug the SD card into the computer.

Of course it would be so much simpler to plug the SD card in, but project restrictions. The computer can't know it had an external hard drive connected. Don't freak out, this is being developed for perfectly legal uses. And I would like to thank you all for clarifying. I'm not new to programming but I am new to Arduino, so really I'm just trying to figure out what it is capable of. I have a few other ideas I can work on to solve this problem.

I need to have the serial connection temporarily disabled so that in the computers eye the device is no longer connected.

If you are still using the USB connection of the computer to connect to a standard arduino, that may not be so easy. Probably not an easy way to have the serial interface chip on the arduino to be disabled.

I wonder can you do something like this with a Leonardo?

…R