Solved

How to use "target box" in command prompt properties

Posted on 2006-10-27
7
2,412 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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 …

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now