Get help on file
Moderator: DosItHelp
Get help on file
Hi everybody,
Hi everybody
I have a txt file to run various exe files
1.exe
2.exe
3.exe
Which script I can run from the beginning to the end of the file and when finished running a file, then remove from the file is always txt
Please help everyone
Hi everybody
I have a txt file to run various exe files
1.exe
2.exe
3.exe
Which script I can run from the beginning to the end of the file and when finished running a file, then remove from the file is always txt
Please help everyone
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Get help on file
Just change the extension from .txt to .bat and the three executables will run one after the other in order until all three are done.
Re: Get help on file
My idea as well as random scrip just now is that I want to run the lines in the txt file and every time I run it, I delete the line that was running.
@Echo Off
For /F "tokens=2 delims=:" %%j in ('Find /C /V "" random.txt') Do (
Set MOD=%%j
)
Set MOD=%MOD:~1%
:LOOP
Set N=%random%
If %N% gtr 132 Set N= %N:~-2,2%
Set N=%N: 0=%
Set /A N=%N%%%%MOD%+1
Set GRTS=
For /F "tokens=1-2 delims=[]" %%j in ('Find /N /V "" random.txt') Do (
If "%%j"=="%N%" If not "%%k"=="" Set GRTS=%%k
)
If not defined GRTS GoTo :LOOP
Echo. %GRTS% > lastactionlaunched.txt
set /a timeout=!random! %%10
start %GRTS%
Set MOD=
Set N=
Set GRTS=
:: End_Of_Batch
@Echo Off
For /F "tokens=2 delims=:" %%j in ('Find /C /V "" random.txt') Do (
Set MOD=%%j
)
Set MOD=%MOD:~1%
:LOOP
Set N=%random%
If %N% gtr 132 Set N= %N:~-2,2%
Set N=%N: 0=%
Set /A N=%N%%%%MOD%+1
Set GRTS=
For /F "tokens=1-2 delims=[]" %%j in ('Find /N /V "" random.txt') Do (
If "%%j"=="%N%" If not "%%k"=="" Set GRTS=%%k
)
If not defined GRTS GoTo :LOOP
Echo. %GRTS% > lastactionlaunched.txt
set /a timeout=!random! %%10
start %GRTS%
Set MOD=
Set N=
Set GRTS=
:: End_Of_Batch
Re: Get help on file
Code: Select all
@echo off &setlocal enableDelayedExpansion
set "$fileIn=exeLines.txt"
set "$fileTMP=exeLines.tmp"
::
:loop ()
:: (
< "!$fileIn!" (
set "$=" &set /P "$=" &if defined $ (
echo.start '!$!'
rem start "" /WAIT "!$!"
)
)
copy/V/Y/B "!$fileIn!" "!$fileTMP!" >nul
< "!$fileTMP!" >"!$fileIn!" (
more +1
)
del /F "!$fileTMP!"
< "!$fileIn!" (
set "$=" &set /P "$=" &if defined $ (
goto :loop "()"
)
)
:: )
pause
exit
Code: Select all
start 'program1.exe'
start 'program2.exe'
start 'program3.exe'
Druk op een toets om door te gaan. . .
Re: Get help on file
Code: Select all
@echo off &setlocal enableDelayedExpansion
set "$fileIn=exeLines.txt"
set "$fileTMP=exeLines.tmp"
::
:loop ()
:: (
< "!$fileIn!" (
set "$=" &set /P "$=" &if defined $ (
echo.start '!$!'
rem start "" /WAIT "!$!"
)
)
copy/V/Y/B "!$fileIn!" "!$fileTMP!" >nul
< "!$fileTMP!" >"!$fileIn!" (
more +1
)
del /F "!$fileTMP!"
< "!$fileIn!" (
set "$=" &set /P "$=" &if defined $ (
goto :loop "()"
)
)
:: )
pause
exit
Code: Select all
start 'program1.exe'
start 'program2.exe'
start 'program3.exe'
Druk op een toets om door te gaan. . .
Thank you very much
But this is also a random script in txt file exeLines. The idea I need is that when running scrip it will run in line order in the txt file exeLines
program1.exe
program2.exe
program3.exe
After running the program1, it deletes the line from exeLines.txt
Re: Get help on file
No, not a random script in txt file exeLines, but a reply to your initial question.duonga wrote: ↑01 Dec 2018 02:31Thank you very much
But this is also a random script in txt file exeLines. The idea I need is that when running scrip it will run in line order in the txt file exeLines
program1.exe
program2.exe
program3.exe
After running the program1, it deletes the line from exeLines.txt
Re: Get help on file
thank you .i have got confusion about copy file about. it works very well
Re: Get help on file
No, not a random script in txt file exeLines, but a reply to your initial question.
[/quote]
You can add conditions if the empty exeLines.txt file copies the data from the input.txt file
[/quote]
You can add conditions if the empty exeLines.txt file copies the data from the input.txt file