Backticks in Windows Cmd - Perl to the Rescue

Ever missed Backticks in the Windows Cmd?

Use Perl.

perl -e "system( 'text' . `command` )"

perl -e run a single line of a program

" " enclose the program to make a single string for the Windows CMD

system() run the program

print() print the program

' ' (Apostrophe, ASCII 39) text part

` ` (Grave Accent, ASCII 96) command part, run and get returned string

. (Period, ASCII 46) concat the strings

Example

perl -e "print ( 'gcc -o ctest main.c' . `perl -MExtUtils::Embed -e ccopts -e ldopts` )"
perl -e "system( 'gcc -o ctest main.c' . `perl -MExtUtils::Embed -e ccopts -e ldopts` )"

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    Discussions