Repeat a cmd command
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 answers
-
Thank you all for your responses
I finally managed to do it thanks to you
Thank you!
-
Moderator
To do this across the entire screen, open a command line window, switch to full screen: ALT + Enter, then launch the .cmd file
-
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.
-
-
@brucine
Hello!
It works for me, I can color the console well, but our friend Ssio wants to color his screen, what adjustment to the command then?
-
@quentin2121
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
-
@brucine
The first command triggers nothing
The second one does not become .cmd with the gear wheel as the thumbnail icon!
-
@quentin2121
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.
-
-
Moderator
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
-
-
Moderator@brucine
Yes, but if we don't have, like all of us, the tech-savvy fiber, we can write:
color a dir/s :begin goto begin
especially if we type it each time in a CMD window, not with a batch file.
-
@jee pee
No, you need to put dir /s after the label :begin.
I'm not sure that branching instructions are only read in a batch file and not at the command line, that's another question. -
Moderator@brucine
Yes, of course, it was an example of code to illustrate an error that someone with little experience might write if they are not given the complete code.
-
-
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
-
Moderator
Hello,
:begin
goto begin-
-
@3ssio
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-fileWe 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.
-