Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

dos scripting question

Name: darkness_and_light 2008-06-24 1:44

Working on a hardware/software inventory project for a museum.  For budget reasons they can't afford to buy software to do the data collection.  As an intern they basically dropped the project in my lap and told me to have fun.

I could just write the project proposal to have each department fill out a paper form for each computer they own, which basically means interns in other departments will do my work for me.  However I've decided to cobble together something to do the data collection for them (also saving me the trouble of data entry).

I've written a batch file to take care of the data collection on each local computer.  Now I'm wondering how I'm going to process all these files once they all get sent back to me.  One idea I have is to put all the data files(hopefully with unique names) into one directory, route the results of a DIR into a .txt file then sequentially operate on the file matching each of the names in the .txt file.

Anyone have any better ideas or suggestions on another way to do this?  I've worked with C++, Java, and VB but I haven't done anything with them involving working with directories or files.

Name: Anonymous 2008-06-24 1:45

Here is the batch file I wrote if anyone is interested:

@echo off

name.vbs

echo Checking registry for software licenses
rem Adobe licenses
regedit.exe /e photoshopcs2.txt HKEY_LOCAL_MACHINE\SOFTWARE\ADOBE\PHOTOSHOP\9.0\
regedit.exe /e photoshopcs3.txt HKEY_LOCAL_MACHINE\SOFTWARE\ADOBE\PHOTOSHOP\10.0\
regedit.exe /e illustratorcs2.txt HKEY_LOCAL_MACHINE\SOFTWARE\ADOBE\ILLUSTRATOR\11.0\
regedit.exe /e illustratorcs3.txt HKEY_LOCAL_MACHINE\SOFTWARE\ADOBE\ILLUSTRATOR\12.0\

rem Microsoft Office licenses
regedit.exe /e office2000.txt HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\OFFICE\9.0\
regedit.exe /e officexp.txt HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\OFFICE\10.0\
regedit.exe /e office2003.txt HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\OFFICE\11.0\
regedit.exe /e office2007.txt HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\OFFICE\12.0\

rem FileMaker licenses
regedit.exe /e filemakerpro8.txt "HKEY_LOCAL_MACHINE\SOFTWARE\FILEMAKER\FILEMAKER PRO\8.0\"
regedit.exe /e filemakerpro9.txt "HKEY_LOCAL_MACHINE\SOFTWARE\FILEMAKER\FILEMAKER PRO\9.0\"

rem Macromedia Dreamweaver licenses
regedit.exe /e dreamweaver8.txt "HKEY_CURRENT_USER\SOFTWARE\DREAMWEAVER 8\"

echo Checking version of Windows
copy C:\WINDOWS\system32\prodspec.ini version.txt

echo Checking system information
winmsd /categories +SystemSummary-Resources-Components+ComponentsStorageDrives-SWEnv-InternetExplorer-Apps /report systeminfo.txt

complete.vbs

Name: darkness_and_light 2008-06-24 3:16

>>5
It is DOS,  I'm calling Microsoft applications from the command line to generate log files in .txt format.  The only real DOS command I'm using so far is copy.

>>6
I'm writing it with DOS and some .vbs because thats what I know how to use.  The data comes out in the format used by the Microsoft regedit.exe and winmsd.exe applications.  I have another batch file that checks for the existence of the regedit output files then writes a 0 or 1 in the summary.txt file on the appropriate line.  Alternatively I could have just output the entire HKEY_LOCAL_MACHINE\SOFTWARE\ tree and parsed it, but this seemed easier.  I will have to write something to parse the winmsd.exe output though.


The problem isn't processing the data for the individual computers, thats more or less done.  The problem is processing all of the reports generated by all 200+ computers.  The name.vbs script at the top of the batch file should get them to generate a unique name for each computer's report, but once I receive them all I'm trying to figure out how to process them into a single file that I'm in turn going to feed into a database, which I'm researching how to do right now too.

I'm just glad I don't have to do this for the Macs littered around the grounds, apparently one of the department heads already took care of it.

Name: darkness_and_light 2008-06-24 3:43

>>8

Its a Window XP Pro machine, but I'm writing a .bat file using notepad which uses DOS commands. 

Basically I'm going to have 200+  files named ento01.txt, anthro5.txt, astro04.txt, or whatever that I'm going to dump into the same directory.  The files are probably going to be in something like:

Windows XP Professional
x86 Family 6 Model 15 Stepping 2 GenuineIntel ~1728 Mhz
2,048.00
106.72 GB
0
1
0
0
0
0
1
1
0
etc.

I studied Perl for a little bit, but I don't remember a way to sequentially execute a process on the contents of a directory.  Actually now that you bring up Perl I should ask at the web development place I intern at if SQL might have functions built in I could use.

Name: darkness_and_light 2008-06-24 4:43

>>11
Do we really have to argue semantics?  The command prompt is functionally and visually similar to DOS.  Yes, I realize its just a virtual machine.

Name: darkness_and_light 2008-06-24 4:51

>>12

So its a for-loop using a function built into the scalar variable type?  I'll look into it.

Name: darkness_and_light 2008-06-24 5:26

>>17

I used those commands on my Dad's old IBM PC before I even heard of Windows.  The platform they are running on may have changed, but I used them on DOS first so I call them DOS commands so yes it is just semantics. 

Note I am not calling the Command Prompt DOS, I am calling the commands I use at the Command Prompt DOS commands because thats where they came from.

Name: darkness_and_light 2008-06-24 5:48

Except for the calls to VB scripts which are really only there to get the users attention and easily replaced with DOS commands and assuming there were equivalent DOS utilities with the same flags, and the files the utilities access were in the correct place it would work just fine.

Name: darkness_and_light 2008-06-24 5:58

But back on topic, another thought occurred to me.  I'm not limited to just DOS batch files, I can use Windows scripts.  Windows scripting is probably better equipped to work with files and directories.  The actual program performing the parsing can be VB, C++ or whatever.

Thanks, anon.  Arguing semantics actually gave me a push in the right direction.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List