Introduction: 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` )"

Comments

About This Instructable

27views

0favorites

License:

More by ritterst:Backticks in Windows Cmd - Perl to the RescueGinger AleBelt Sander Seam Rubber
Add instructable to: