Solved

How to use "target box" in command prompt properties

Posted on 2006-10-27
7
2,418 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 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 65

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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
This article will show, step by step, how to integrate R code into a R Sweave document
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 …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

778 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