zib32 Posted July 29, 2009 Share Posted July 29, 2009 Hello, I am working on a program to parse windows script so it is more human readable. (So the user can see all of the associated scripts with a windows script file). Here is a sample piece of default file where the variables for the script are declared set INTCMDR=e:\dat\st\tdrvr.dat set TCMDRFM=e:\st\st\t_driver.dat set SHOWTDRVRSEM=e:\st\st\showTDriver.sql And here is a piece of the windows script file... REM ================================================== REM Begin truncate and load of t_driver REM ================================================== %sqlcmd% /d etl /Q "sp_printHdr @strText='Begin t_driver truncate and load'" -E -w 90 echo ** Truncating t_driver %sqlcmd% /Q "TRUNCATE TABLE st..t_driver" %CONISQL% /d %DATABASE% /r 0 /b > nul echo ** Inserting t_driver records bcp %TCMDR% in %INTCMDR% /f %TCMDRFM% /m %MAXERRORS% /e %TCMDRERR% /b 30000 %CONBCP% -h "TABLOCK" REM ================================================== more windows script.... So if a user wanted to go through and find the associated scripts/files, they would have to match up each variable in the default file which can take quite a while. What I would like my program to do is isolate each variable in the code such as %TCMDRFM%, match it to its value in the default file TCMDRFM=e:\st\st\t_driver.dat. So the output I would like to look something like: DATA FILES: TCMDRFM=e:\st\st\t_driver.dat ... ASSOCIATED SCRIPTS: SHOWTDRVRSEM = e:\st\st\showTDriver.sql ... (Identify and Organize them based on the extensions at the end of the file.) Now I can open the file fine, read line by line and isolate the variables in the script fine using str_pos, str_replace, and explode but I am having difficulty matching up the variables to the values stored in the default file. Any idea how to go about doing this? Link to comment https://forums.phpfreaks.com/topic/167971-need-help-with-project/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.