Hello All,
I'm trying to execute series of command read from a file using perl.
Below is a sample file
(NOTE: I don't want to use Windows batch script to execute the commands, actual file contains more than 200 lines which is generated based on some configuration during build)
Ex: Sample file contents are as below -
Line 1: set Build_DIR=c:\build_proj1
Line 2: md %Build_DIR%
Line 3: cd %Build_DIR%
Line 4: copy c:\proj\*.* c:\build_proj1
Line 5: dir
LINE 6: {TOOLPATH}\catalyst.exe /E "{CODEDIR}\proj1
\dir1\#catexe
2#\#catexe[0]#_multilang.ttk" "{CODEDIR}\bin\#catexe
2#"
LINE 7: {SIGNPATH}\signtool.exe proj1.msi "Proj1 Digital Signature"
LINE 8: call test_it.bat
etc.
Before executing the above commands I have to replace the tokens {TOOLPATH}, {CODEDIR} ,{SIGNPATH}, #catexe
2# etc.
Also for some commands (ex; signtool.exe) if they fail, retry the command execution for 5 times and return the status.
Please help, how to execute the commands in a shell(cmd.exe) and get the output(including errors) and execution status of each command.
Regards,
SSDP
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.