Windows 10 bat Script get stuck on large files - batch-file

I got a bat script that is starting in one part sort to sort large text files ~ 3-40 Gigabye. The part is
#Echo Merge ..
D:/filetype/core/sort.exe -b -T D:\filetype\core\tmp\ D:\filetype\module\model_bruteforce\merge\merged_tmp1.txt -o D:\filetype\module\model_bruteforce\merge\merged_tmp2.txt
del "D:\filetype\module\model_bruteforce\merge\merged_tmp1.txt" > nul 2>&1
#Echo Fixing forwardslash ..
sort.exe is closed properly after the job is done but the bat script getting stuck and pauses before #Echo Fixing forwardslash (without message), i often need to press the enter key to go on to the next step, but not everytime.
What can cause this? And how could i get more stability? I first saw this after i went from a Windows 10 64 bit to a new more powerful computer but also with windows 10 64 bit, both computer got only a HDD Hardisk but using different CP and GPU's

Related

Windows 10 Updated - Now PDFTK batch file broken

I have a batch file that runs a simple "burst" (a.k.a. split) multi-page PDF into single pages scripts, then moves them to a mapped network drive (Z:\). This batch file is triggered by the user and has been working without a hitch for at least two years. Last week, there was a flurry of Windows 10 (x64) updates and it stopped working. Now, instead of looping over every PDF in the source dir, the batch file will generate single pages for the first PDF in the iteration, then stops (although not showing any errors in output). I have tried a multitude of fixes, including using a full timestamp in the target file names to prevent overwriting, though I don't think that's the problem. It seems too coincidental that it just stopped working shortly after the updates (per my User). I'm not very experienced with batch files, and just drew this up based on a PDFTK example I saw. Here it is (not sure why line 2 is being split in the markup, but in the batch file lines 2 & 3 here represent a single line; PS the last line is also being weird, should read: del "C:\Users\My User\Desktop\PHYS_SRCDIR'BACKSLASH''STAR''DOT''STAR'" /F /Q):
cd C:\Users\My User\Desktop\PHYS_SRCDIR
for /r %%i in (*.pdf) do (pdftk "%%i" burst output "Z:\PHYSICALS_IN\%date:~10,4%%date:~4,2%%date:~7,2%_%%~ni_%%03d.pdf")
del Z:\PHYSICALS_IN\doc_data.txt /F /Q
del "C:\Users\My User\Desktop\PHYS_SRCDIR\*.*" /F /Q
I haven't seen any new responses lately, and have to divert my attention elsewhere, so my solution was simply to move the batch file to the server w/ "Z:" on it (allowing a limited login to the User), reverse it so it copies from User's PC mapped drive to the Server, and move on to the bigger fish I have to fry. I know, it's not really a solution but that is my circumstance. I'll check in from time to time to see if there are any other suggestions. Since the batch file works perfectly from a WS2012R2 box my only thoughts are that something in Windows 10 "broke" either PDFTK Server or batch files/command-line in general. Since it works singly and only breaks when trying to loop over several multi-page PDFs, I'm leaning toward batch files/CLI. Thanks for the suggestions, keep 'em coming!

i need to make a batch file run every few seconds. How do i do it?

im on Windows 10. I want my script to run every few seconds or, if even possible, every second. I need it so i can get Every Picture on my FTP Server as soon as possible without any delay
I have tried to do it with task scheduler, but the fastest i can do is every 5 Minutes
Administrator
Pw123
cd Kamera-1
lcd C:\xampp\htdocs\website\Bilder\Kamera-1
binary
mget *.jpg
mdel *.jpg
bye
Here is my Script. The first 2 Lines are the Logins to my FTP Server and the rest is just to get the files and then delete the files on the ftp, so i dont download it twice
To answer your literal question: Just loop your code in the batch file, with a short delay:
:start
<your code here>
timeout 5
goto start
Though as said in the comments, there are better ways to achieve what you want.

Automating FFmpeg/ multi-core support

I need help with FFmpeg/batch. I have a couple of large batches of images (+14000 files each batch, +5 MB each image, .TIFF all of them) and I'm stringing them together into a .mp4 video using FFmpeg.
The date in the metadata is broken because of the way they're stored upon creation, so the time and date (T/D) are on the file_name. I need each frame to have its respective T/D (so its File_Name) burnt onto them for accurate measurements (scientific purpose).
With the help of google and reddit, I've managed to semi-automate it like so:
Master.bat:
forfiles /p "D:\InputPath" /m "*.TIFF" /S /C "cmd /c C:\SlavePath\slave.bat #file #fname"
Slave.bat:
ffmpeg -i "%~1" -vf "drawtext=text=%~2: fontcolor=white: fontsize=30: fontfile='C\:\\FontPath\\OpenSans-Regular.ttf'" "D:\OutputPath\mod_%~1"
Running Master.bat will output each individual image with the text burnt onto them and change the File_Name to mod_'File_name'.TIFF
Real example: 2018-06-05--16-00-01.0034.TIFF turns into mod_2018-06-05--16-00-01.0034.TIFF
The problem is that FFmpeg doesn't like it when my files have "--" in them ("date--time.miliseconds.TIFF") and doesn't like the miliseconds either, so I have to change the name of all files "manually" using Bulk Rename Utility (BRU). So, using BRU I rename all files to 00001.TIFF, 00002.TIFF, etc. and FFmpeg likes me again. It works great, but it means I can't be AFK.
After that, I have to go back to cmd and manually start the image to video conversion.
Also, FFmpeg doesn't seem to be using all cores.
I need help finding a way to:
Change master.bat's output to 00001.TIFF etc. automatically in order of processing (i.e. first to be processed is 1.TIFF, 2nd is 2.TIFF)
Add ffmpeg's img-to-vid function to the automating system
Get my CPU to use all the cores effectively if possible. 2014/15 posts found on google make it seem as though FFmpeg doesn't support multi-core or hyperthreading.
64bit Windows, i7 7700hq, gtx 1050 4Gb, C: SSD, D: HDD
Try this:
ffmpeg -i "2018-06-05--16-00-01.%4d.TIFF" -threads 4 out.mp4
https://en.wikibooks.org/wiki/FFMPEG_An_Intermediate_Guide/image_sequence

"more" command will not save to file

I am trying to delete the first 200 lines in a .txt file.
The above code has been working for months but just recently has stopped working, the code runs up to the more command then stops.
If I press the keyboard a few times it will trigger something and start moving on to the next lines of code.
I want this code to run without me manually pressing the keyboard a few times while running.
As a side note if I close the terminal window instead of forcing the script along and then try to delete the new database2.txt file, I get an error that the file cannot be deleted because it is in use by more.com.
My code:
cd c:\folder
more /E +200 Database.txt > Database2.txt
timeout 10
del /f Database.txt
timeout 10
rename Database2.txt Database.txt
timeout 10
exit;
I am running:
Windows 10 home version 1703
OS build: 15063.674
Ram: 6gb
X64 processor
64bit OS
Intel core i5-2430m cpu#2.40ghz
Any help is appreciated!!
I appreciate everyone's help in trying to figure out my problem but I have found the solution. I formatted the comand in this way:
">Database2.txt (
More +200 Database.txt
)"
If someone could shed some light as to why this happened or how this format has fixed my problem when it is supposed to be the same command that would be great!

Why does my batch file continue to run before waiting for a timeout command?

cd "..\..\..\Sound"
start "" "mt32.exe"
timeout /T 5 /nobreak > NUL
cd ".\"
SCIV.exe
If you are at all familiar with DOSBox, I'm using a DOSBox fronted (D-Fend Reloaded) to launch a .bat which contains this code. What's supposed to happen is this:
The batch file changes directory and launches mt32.exe (which is an autohotkey script that opens up a MT-32 synthesizer)
The batch file waits for 5 seconds
The batch file then changes to its own directory and launches SCIV.exe (which is the exe for the game Space Quest III
What actually happens is that after starting mt32.exe, it blows right past the the timeout command and starts the game. I wonder if D-Fend Reloaded (the frontend) is pre-loading the batch file and executing it on its own terms or something?
Anyways, I'm wondering if there's any way I can actually enforce the timeout and make sure that it occurs before the game is launched; it's fairly critical. The point is to make sure that the mt32 synth has enough time to fully initialize before the game starts.
This may work:
ping 127.0.0.1 -n 6 >nul

Resources