loading

Have you ever typed "echo %username% " and gotten something like your username. For example from command prompt.

How about using %appdata% as a shortcut tp locate the Application Folder or %temp% to locate the Temporary Folder?

So as you can see, how about writing a programme to fetch important information on a computer and then store them in a text file you can use later.

Step 1: Identify Top Variables You Can Use

Open CMD and then type the following;

C:\>set 
<strong>TMP=C:\Users\SAMUEL~1\AppData\Local\Temp<br>USERDOMAIN=MICROSOFT-SOLUT
USERDOMAIN_ROAMINGPROFILE=MICROSOFT-SOLUT
USERNAME=SamuelOppong
USERPROFILE=C:\Users\SamuelOppong
VBOX_MSI_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\
windir=C:\WINDOWS</strong>

Pull the list of variables to a text document; do that by piping the results;

C:\>Set >C:\Temp\SetVariables.txt

Step 2: Identifying the Most Important Bits of Information

If you went to a computer store, one of the first things you would look at include the following;

1) Manufacturer's Name
2) Processor
3) RAM Installed
4) Storage Size

Now what if you worked as IT Support Engineer and you wanted to pull some data regarding a specific computer. You would normally be able to check this yourself but the user at the end of the phone call is not able to tell you the details you need.

Step 3: Creating the PC Survey Model

Your script should contain a brief description the computer and must be able to be exported as a text document which could easily then be emailed to the IT Support Engineer.

For example, we would have something as follows;

Hi Support, I am logged in as %username% on Server %logonserver%.& echo Please note that I am sitting on a %OS% System with my machine name being %computername%.

PS: & echo serves as a next line.

So the actual working code would be as follows;

echo Hi Support, I am logged in as %username% on Server %logonserver%.& echo Please note that I am sitting on a %OS% System with my machine name being %computername%.

Step 4: Final Notes

Be creative, write down your machine report or survey script. Fill in the blanks with the variables and then save the file as a batch file. Let see the example below;

@echo off
cls
rem This is computer survey from a user on the network
echo Hi Support, I am logged in as %username% on Server %logonserver%.& echo Please note that I am sitting on a %OS% System with my machine name being %computername%.
pause

See resource here for very good examples too.

SET Usage Examples

About This Instructable

1,249views

26favorites

License:

More by samueloppong:Fundamentals Of Networking | Understanding Network Devices Who is that on my network and what is he doing? Network Forensics Tutorial? Advanced CMD Troubleshooting For the IT Pro  
Add instructable to: