Question: Part 1 - Creating a Perl Script to Access the Win 3 2 API This program will pull system data from the Windows OS using
Part Creating a Perl Script to Access the Win API
This program will pull system data from the Windows OS using Win API functions.
Start Notepad and create a new file called Winpl and save it to a memorable location such as C:StrawberryScripts
In the new Notepad file, type # Winpl on the first line and press ENTER.
Write comments for documenting the program. Be sure to enter your name, course number, date, and a brief description of what the program does.
After your lines of documentation, press ENTER two times to create a blank line for separating your comments from the script code.
Type use win; and press ENTER this imports the win module
Type $login Win::LoginName; and press ENTER this populates the $login variable with the data gathered from LoginName
Type $NetBIOS Win::NodeName; and press ENTER this populates the $NetBIOS variable with the data gathered from NodeName
Type $Filesystem Win::FsType; and press ENTER this populates the $Filesystem variable with the data gathered from FsType
Type $Directory Win::GetCwd; and press ENTER this populates the $Directory variable with the data gathered from GetCwd
Type $osname Win::GetOSName; and press ENTER this populates the $osname variable with the data gathered from GetOSName
Type print $login
; and press ENTER this prints the data in the variable
Type print $NetBIOS
; and press ENTER this prints the data in the variable
Type print $Filesystem
; and press ENTER this prints the data in the variable
Type print $Directory
; and press ENTER this prints the data in the variable
Type print $osname
; and press ENTER this prints the data in the variable
Your code should now look similar to the screenshot below.
Select two more Win API Functions from the WinAPIFunctions.pdf document in the Lab Resources section or another source and add them to the code.
Add comments to the code to make it more readable and understandable
Add labels to print statements andor create new print statements to make the output more understandable
Save the script file, open a command prompt cmd navigate to the folder containing your Winpl file, and run the script by typing perl Winpl and pressing ENTER.
Take a screenshot of the script code and paste it in your Lab Report with captions or titles.
Take a screenshot of the script output and paste it in your Lab Report with captions or titles.
Analyze and research results and scripts for a consolidated writeup to include in Analysis section of your Lab Report
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
