Pause execution de mon batch
ProtecTueur
Posted messages
24
Registration date
Status
Member
-
ProtecTueur Posted messages 24 Registration date Status Member -
ProtecTueur Posted messages 24 Registration date Status Member -
Hello,
I still have a problem with my line of code, I'll pose my topic with a more appropriate title.
However, my problem is that the program creates the directory "TEST", moves the mspaintboucle.bat which created it (the TEST directory), but I need to go into "C:\WINDOWS\SYSTEM32\TEST\" to click on mspaintboucle.bat again to execute this:
Because it won't have created "nouveau.bat", but by clicking on it again, it will create it and start the loop.
My problem is that I have to click twice on the mspaintboucle.bat, the first time from my desktop and the second time in the directory it created to be able to create "nouveau.bat" and run it in a loop; I would like to avoid the double click and have it execute with a single click. Is it because "nouveau.bat" doesn't have time to be created and the application ends before it can be created? And if that’s the case, I would like to know how to add a pause between the creation of "nouveau.bat" and the loop so it has time to be created, or if it’s an error in my code that makes this impossible to achieve? In that case, any help would be welcome.
I still have a problem with my line of code, I'll pose my topic with a more appropriate title.
@echo off cls MD "C:\WINDOWS\SYSTEM32\TEST" This creates the directory / folder TEST. FOR /F %%a in ('DIR /b *.bat') DO MOVE "%%a" "C:\WINDOWS\SYSTEM32\TEST" This moves mspaintboucle.bat which is this batch file into the created directory echo "@echo off">nouveau.bat echo cls>>nouveau.bat echo start mspaint>>nouveau.bat This will result in creating the file "nouveau.bat" that will loop mspaint with the following line :boucle start C:\WINDOWS\SYSTEM32\TEST\nouveau.bat goto boucle PAUSE However, my problem is that the program creates the directory "TEST", moves the mspaintboucle.bat which created it (the TEST directory), but I need to go into "C:\WINDOWS\SYSTEM32\TEST\" to click on mspaintboucle.bat again to execute this:
echo "@echo off">nouveau.bat echo cls>>nouveau.bat echo start mspaint>>nouveau.bat This will result in creating the file "nouveau" that will loop mspaint with the following line :boucle start C:\WINDOWS\SYSTEM32\TEST\nouveau.bat goto boucle
Because it won't have created "nouveau.bat", but by clicking on it again, it will create it and start the loop.
My problem is that I have to click twice on the mspaintboucle.bat, the first time from my desktop and the second time in the directory it created to be able to create "nouveau.bat" and run it in a loop; I would like to avoid the double click and have it execute with a single click. Is it because "nouveau.bat" doesn't have time to be created and the application ends before it can be created? And if that’s the case, I would like to know how to add a pause between the creation of "nouveau.bat" and the loop so it has time to be created, or if it’s an error in my code that makes this impossible to achieve? In that case, any help would be welcome.
Configuration: Windows XP Firefox 2.0.0.14
13 answers
-
set a timer???
it's possible in all languages, it seems to me
I should pull out my DOS book ;o)) -
Yes, basically, but is my code correct? Except for the timer?
-
Yes, it seems roughly right, for the Timer, look a bit, I'll give you the answer in 10 minutes :)
-
Alright then... here you go:
set /A heurfin=%time:~6,2%+X
:start
set /a heur=%time:~6,2%
set /a temprestant=%heurfin%-%heur%
if "%heurfin%"=="%heur%" goto finpause
goto start
:finpause -
puree of goto ... I'm missing go subs and it will be complete
... it reminds me of my first hours of computing...
those before Windows 95, when DOS 5.0 was a reference and 6.1 was crap, except for dblspace.exe
lol -
Is it incomplete here? 6.2 being in second?
-
I did it like this, but it doesn't work, where is the error?
-
No, X must be in second.
I don't think it's a timing issue! The execution of a script is always sequential, and your files are very small.
Where do you create your new.bat?
It's normal that it's not working; you are not respecting the current directory, the PATH, etc.
--
Best regards!
Char Snipeur -
My directory is created in C:\WINDOWS\system32\TEST so that I can launch it with the "start" function, and my file is created inside it.
-
@echo off cls MD "C:\WINDOWS\SYSTEM32\TEST" 'This creates the TEST directory. FOR /F %%a in ('DIR /b *.bat') DO MOVE "%%a" "C:\WINDOWS\SYSTEM32\TEST" This moves mspaintboucle.bat, which is this batch file, inside the created directory cd C:\WINDOWS\SYSTEM32\TEST\ call "C:\WINDOWS\SYSTEM32\TEST\mspaintboucle.bat" echo "@echo off">nouveau.bat echo cls>>nouveau.bat echo start mspaint>>nouveau.bat This will result in creating the file "nouveau.bat" which will execute mspaint in a loop with the following line:loop start C:\WINDOWS\SYSTEM32\TEST\nouveau.bat goto loop PAUSE--
Greetings!
Char Snipeur -
Listen, it's still not working, the directory is created, the .bat that contains the code moves into it, but nothing triggers mspaint, I even tried to cd/call the new.bat but nothing, it's such a simple thing that it's driving me crazy...
-
nothing launches mspaint?
have you at least tested that this command was sufficient, that mspaint is indeed in the PATH?
--
Greetings!
Char Snipeur -
Well, listen, if I launch the file, and I go to the created directory, and I click on it again, it works. So you have to click on it twice... And that's what I would like to avoid.