General discussion

Locked

SET

By frec1 ·
Can someone please explain the SET command in DOS, I somewhat understand it and use it all of the time. I miss the undewrstanding of it?

THanks,
Frec

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

SET

by asbjorn.alveberg In reply to SET

The set command assigns a value to a variable. Think of a variable as a box in which you can put data. You create the box and put data into the box with the set command.
Example: set Department = Sales
Now you can use the contents of the box within a batch file. Example echo %Department% will return Sales on the command line.

If you put something else in the box, the first contents will disappear. Example: set Department = Purchase
Now the echo %Department% will return Purchase, Sales is now gone.

Collapse -

SET

by frec1 In reply to SET

The question was auto-closed by TechRepublic

Collapse -

SET

by Tim Parkins In reply to SET

Hi,

Above answer is bang-on, I just wanted to add one thing...
If you type the SET command by itself (ie. no variable name), it will return the values of all of the current environment variables.

Collapse -

SET

by frec1 In reply to SET

The question was auto-closed by TechRepublic

Collapse -

SET

by Lo In reply to SET

The Environmetn Variables are also available from a programming language both to read or set. This gives some felxability: If install defines:
SET APPROOT=D:\SOMEDIR\SUBDIR

You can play games, test, etc. by
SET APPROOT=G:\PLAYGAME\TEST
which would then look for files, create files, etc. in the G:\PLAYGAME\TEST path without having to change the application code rather than the 'real' path.

Collapse -

SET

by frec1 In reply to SET

The question was auto-closed by TechRepublic

Collapse -

SET

by frec1 In reply to SET

This question was auto closed due to inactivity

Back to Windows Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums