Solved

How to use "target box" in command prompt properties

Posted on 2006-10-27
7
2,421 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 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
Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

A short article about problems I had with the new location API and permissions in Marshmallow
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

733 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