?
Solved

How to use "target box" in command prompt properties

Posted on 2006-10-27
7
Medium Priority
?
2,434 Views
Last Modified: 2010-05-18
When looking at properties on a "cmd" icon (the old black DOS icon) toward the top of the properties window is a box labeled "target" which sometimes points to a batch file.

Can anybody tell me the exact use of this "target" box? I assume the indicated batch file is executed to set up enviornmental variables such as paths.

Thanks for any help.

sundownr
0
Comment
Question by:sundownr
7 Comments
 
LVL 54

Assisted Solution

by:b0lsc0tt
b0lsc0tt earned 240 total points
ID: 17820635
sundownr,

Target is what the icon points to or what it will run when clicked.  An icon that just opens the prompt and does not run a batch file will actually point to cmd.exe or command.exe in the System32 folder.  Batch files, since Windows also associates them with DOS, will use a similar icon when one is created.  The target in that case is the batch file itself though.  The basic answer to your question though is the target setting tells the icon what to run.

Let me know if you have any questions or need more information.

b0lsc0tt
0
 
LVL 66

Accepted Solution

by:
Jim Horn earned 260 total points
ID: 17820637
The Target textbox allows you to add command-line switches to running your app.
Here's the Access answer to your question, which somewhat applies to VB as well
http://support.microsoft.com/default.aspx?scid=kb;en-us;209207
0
 
LVL 6

Expert Comment

by:SCDMETA
ID: 17820748
The "target box" is actually a property of the shortcut, not a property of the cmd icon.

When you create a shortcut, whether it be sitting on our desktop, in the start menu, or in a folder...you must give it certain properties. Specifically a name and a target.  

The name is how you want the shortcut to appear.  

The target can be a variety of items: an exe, a bat file, a vbs file, a drive, a folder, a document, a url, a printer, a computer, etc.

----
In your case, you said you saw a bat file being targetted by a shortcut.  You mentioned that the bat file set up environment variables.    

If this is all the bat file did, then it would not make much sense because the environment variables would only last as long as the command session window.  If you launch the bat file via the shortcut and all the bat file did was set up environment variables, then you would see a DOS box appear briefly, then disappear. Whatever environment variables the bat file setup would be lost.  

If you look closer at your bat file, you will probably see that it calls an exe.  The bat file is configuring the environment variables then calls the exe that runs in the enviroment setup by the bat file.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 17820761
I'm glad that I could be one of those that helped you.  Thank you for the grade, the points and the fun question.
0
 

Author Comment

by:sundownr
ID: 17821011
For clarification the "target box" I was referring to looks like this...

C:\WINDOWS\system32\cmd.exe /k ""C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sdkvars.bat""

Here I was using the .Net SDK version 2.0. Note the /k switch within the "target box" which refers to a batch file.

Using SCDMETA's verbage then I might say the "target box" sets up the properties of the shortcut by explicitly
naming a executable and as well as runs a batch file which in turn sets up enviornmental variables.

My final question (assumption) is... does not the "target box" launch an executable (command prompt) and  as well launch a secondary file which in this case is a batch file?

Is this "double duty" or am I blowing smoke?

sundownr





0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 17821095
> My final question (assumption) is... does not the "target box" launch
> an executable (command prompt) and  as well launch a secondary file
> which in this case is a batch file?
Not exactly.  The target will run cmd.exe.  It will run that file with the switch /k and the input C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sdkvars.bat.  The k switch tells cmd to stay open after running.  Cmd can take the input and it is what runs the bat file.  I hope this helps to answer the follow up question otherwise let me know.
0
 

Author Comment

by:sundownr
ID: 17821409
Thanks again... I was not trying to beat this one to death but rather understand
the complete process at hand.  Your explanation is clear and to the point. I was missing
exactly how th /k switch works.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Loops Section Overview

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question