Sam Weisenthal
Sam Weisenthal

Reputation: 2951

Spawn perl script in colored console

In windows, I was thinking

system "start", "cmd.exe", "color" "25" "/k", "script.pl" 

but it doesn't work. Is there a standard way to do this?

Upvotes: 1

Views: 58

Answers (1)

ikegami
ikegami

Reputation: 386386

First of all, you shouldn't be able to to execute start at all with the multiple-argument form for system since start is a shell built-in. But a Perl bug feature on Windows pretends you said

system 'start "cmd.exe" "color" "25" "/k" "script.pl"'

Which brings us to start's awful syntax. If the first argument is quoted, it's taken to be the window title. You want

system 'start "" "cmd.exe" "color" "25" "/k" "script.pl"'

or just

system 'start cmd color 25 /k script.pl'

Upvotes: 2

Related Questions