Solved

How to use "target box" in command prompt properties

Posted on 2006-10-27
7
2,426 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 54

Assisted Solution

by:b0lsc0tt
b0lsc0tt earned 60 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 65 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
Industry Leaders: 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Six Sigma Control Plans

717 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