Repeat a cmd command
3ssio Posted messages 83 Status Membre -
Hello, I have a question, I would like to create a stylish wallpaper on CMD but I have a problem.
I type (color a) then (dir/s) but the problem is that after a while it stops and I would like it to continue looping indefinitely.
If anyone has an idea or knows how to do it, thank you
Thank you in advance for your responses
Good evening
6 réponses
I want to loop the dir/s command to create a wallpaper, I'm useless and don't know anything about coding
My code: color a
dir/s
but I can't figure out how to loop it
Thanks
Hello,
Once upon a time, jokes were made about PCs with
@echo off title matrix color 0a :top echo %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% goto top
you can do the same with your code
@echo off title Loop color a :top dir/s goto top
I don't know why it's not working.
I think I understood that when I run the dir/s command, it happens instantly, so I can't execute the others.
I believe I'm doing it wrong.
Yes, I truly suck.
Thank you for your responses.
Hello,
We're mixing genres.
The DIR command will not concern the wallpaper but only the console; we don't see the point of repeating it, but if we have to do it not in a batch but directly in the command line, the redirection labels will not be read, we should use something like:
FOR /L %A IN (0,0,1) DO ( DIR /S )
There are different ways to color all or part of the console: the color command (which can be refined by also setting a background color), just the prompt, highlighting text only by echoing ANSI characters, third-party utilities...
But if I want to change my Windows wallpaper, it's independent of such a DOS command, I must create or use a 24-bit bmp image and use, I haven't tested not in a batch but at the command line:
reg add "HKCU\Control Panel\Desktop" /v Wallpaper /d "C:\Path_to_image" /F RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters ,1 ,True
Any command aimed at the registry executes silently (that's actually the danger).
I don't understand your second comment at all (even if I input an incorrect syntax in a cmd file, the batch won't execute, but it will remain a cmd file with its icon); there's no question of executing the two lines separately although maybe we can, they're in a Batch (new text file saved as toto.cmd).
It's worth noting that the image used must be a 24-bit bmp (and adapted to the screen resolution), which is one of the quirks of Windows since it will be immediately converted to jpg and stored in a designated location.
Not many people have bmps on hand, save a jpg as a 24-bit bmp using the graphic software of your choice.
Unfortunately, it doesn't work for me
thank you anyway
Hello,
There are different ways to create an infinite loop in a batch file, including the one that was mentioned, and we don't see why it wouldn't work:
https://stackoverflow.com/questions/5487473/how-to-create-an-infinite-loop-in-windows-batch-file
We don't really see the point of looping a DIR command whether it's colored or not (there are also other ways to color all or part of the console), but if you don't publish your exact code, it will be hard to discuss "it's not working" without further details.