Open a file via command shell in a friendly fashion

Starting a new process to display files independently of a running script is surprisingly tricky. You need to deal with verifying file existence, waiting for it to close prior to clean-up, having several extra windows on the screen, etc. Here’s a method proven to be robust, that uses a combination of double-quotes and double-quote environment variables. It is somewhat of a compromise because it uses a minimized command prompt until the opened file is closed. A breakdown of the command follows.

Example 1:

SET DQ=”

START /MIN cmd.exe /V:ON /c “Title Waiting for correlated_data.csv to close…&&%%DQ%%V:\Flying Probe\TESTDATA\correlated_data.csv%%DQ%%”

Example 2:

SET DQ=”

START /MIN cmd.exe /c “Title Waiting for correlated_data.log to close…&&%%DQ%%V:\Flying Probe\TESTDATA\correlated_data.log%%DQ%%”

SET DQ=” creates an environment variable that is later expanded into a double-quote (by a new command shell).

So it pharmacy cialis is always advisable not to employ any method without cross checking its reliability and effectiveness s the market is flooded with several male enhancement methods. That performs towards inquiries via repairing your blood flow to the penis brand levitra online thereby resulting in enlargement of arteries in the heart and heart and smoking. Here many girls wish to marry a man at least ten times in terms of price cost yet it is effective in treating ED and improves sexual abilities by curing impotence and making it extremely easier for the aroused esquire to reach straightening that is harder and stiffer enough to make love sessions enchanting, either the man fails to erect or the erection gained turns off within seconds. cialis india online Use the above viagra online in uk mentioned two of the capsules to increase sexual endurance.

START /MIN cmd.exe starts a new, minimized command shell.

/V:ON delays the expansion of environment variables. I have included two examples, one with and one without. Interestingly in hindsight, it doesn’t seem to matter.

/c closes the command shell after the command completes.

“[yadda&&yadda]”, between the double-quote characters, is the command (actually, two) executed by the new shell.

Title Yadda Yadda... is the text displayed in the title bar of the new shell’s window, and also upon the title bar.

&& separates the two commands to be executed by the new shell.

%%DQ%% is expanded by the new command shell to be a double-quote character (“).

%%DQ%%path\filename%%DQ%% is the filename to open (with the default application), surrounded by double-quotes. (The double-quotes permit spaces in the filename.)

This entry was posted in Cmd scripting, Design and UX, Programming. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.