0
I am use a windows command prompt for hours a day at work, and I want to spice things up. I want my text color to change color every 1 second. I have a batch script that does this.
@echo off
set NUM=0 1 2 3 4 5 6 7 8 9 A B C D E F
for %%x in (%NUM%) do (
for %%y in (%NUM%) do (
color %%x%%y
timeout 1 >nul
)
)
It nicely changes the color of my foreground or background every second. However, I want to have this batch script run automatically whenever I open my command prompt shortcut. So in my Shortcut properties, I set the "Target" to this:
Shortcut Target:
C:\Windows\system32\cmd.exe /k auto-change-text-color.bat
This works as expected, but because the batch file is running, I cannot use the command prompt. And instead I just see the background color changing once in a while.
Is there any way to run this in the background and continue using the command prompt while the colors change?
If not, is there any other way to do what I want to do? Maybe with Java, perl, or something besides a batch file?
Thank you for your help.
1http://superuser.com/questions/345602/what-is-cmds-equivalent-to-bashs-ampersand-for-running-a-command-without-w also covers this issue – K7AAY – 2014-01-10T19:03:24.193
@K7AAY - Ooh, interesting. I wasn't aware that
<Ctrl-C>
is disabled for background process. I updated my answer to to reflect that only<Ctrl-Break>
works. – dbenham – 2014-01-10T19:13:38.197@dbenham thank you very much for this. I was able to complete it to my liking thanks to you. I made an answer of my own to detail my final batch file and command. – user1776193 – 2014-01-10T23:50:01.927
@dbenham Can you think of a way for me to configure the script, or do this in a way that I can stop or pause the script (color changing), and maybe even start it back up again? Stopping it would be enough, but starting it back up again would be double awesome. Thanks again for everything. Been loving this! http://i.minus.com/iZC4WapYtRVad.gif
– user1776193 – 2014-01-16T16:01:02.243@user1776193 - Very simple :-) One small change to your loop:
if not exist "somePath\pauseColor.signal" color%%X%%Y
. Now you can pause by creating the file, and resume by deleting the file. – dbenham – 2014-01-16T16:19:31.960