|I have a startup script that gets the serial number from a machine using wmi. I created this script to use when imaging a computer and setting it up with prey. It gets the system serial number then calls the prey-config.exe and allows me to paste the serial number in from the clipboard. I'm trying to automate the process as much as possible, so being able to generate a filename using the clipboard contents is what eludes me at this point. Any suggestions to get me going in the right direction?|
::Get Serial from WMI to clipboard
echo Getting Serial Number
::get serial and save in txt file
wmic bios get serialnumber > sn1.txt
::parse file, remove "serialnumber" text and move relevant data to sn2
type sn1.txt | findstr /v SerialNumber > sn2.txt
::sn1.txt not needed, deleting
::copy content of sn2.txt to clipboard
clip < sn2.txt
At this point in the script, it's taken the contents of sn1.txt:
Removed the first line and dumped the rest to sn2.txt as follows:
From here that same info is copied to the clipboard.
How would I script it so that either the file or clipboard contents can be used to rename the file?
sn2.txt > serial#1234abcd.txt