Backticks in Windows Cmd - Perl to the Rescue
by ritterst in Circuits > Computers
983 Views, 0 Favorites, 0 Comments
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` )"