Pages

Monday, May 30, 2011

The Environment in Win32 Shell Scripting

The environment is an area of memory associated with the command processor that provides
upto 32KB of space for storing variables, the variables contain information about the operating
environment that is used by the operating system and other programs in various ways, typically
to inform a program of the location of a certain piece of information it requires. A few examples
follow:

• ComSpec, specifies the location of the command interpreter.
• PATH, specifies the locations to search for commands typed at the command line.
• Prompt, specifies how the command prompt should appear to the user.
• AGE, a user-defined variable for indicating the age of something.
• TEMP, specifies the directories where temporary files should be placed.


Working with ComSpec in Win32 Shell Scripting

Following is an example of how one can work with the comspec keyword

1. Create a Shortcut in a preferred location which is illustrated as follows
2. Now provide the location as illustrated in the following figure
3. Ensure that you key in the command %comspec% for the location, click next and key in a name

for your shortcut and click finish
4. This will help you get a new icon which would look similar to the following … don’t hate me if it


5. Clicking on this will bring up the command prompt.

Working with Path in Win32 Shell Scripting

Open up command prompt and type in the command “Path” and hit enter

You will get a set of path values being displayed separated by semicolons (; )

The inference is the path command displays or sets a search path for executable files.

Working with Prompt in Win32 Shell Scripting

The prompt command allows you to change the MS-DOS prompt to display more or less
information and the syntax is PROMPT [text] . It can take in the following parameters



A typical example is as follows,

Open up the command prompt and key in Prompt $D. The result will be as follows



Interesting ha… I never knew this before. Hope this helps :)

No comments:

Post a Comment