Multiple encoding of videos using AviSynth and X264 from a bat file - batch-file

at the moment i am encoding my videos (vhs restoration) using avisynth and x264 via dragging an .avs file onto a bat file.
This is working great, but my problem (well not really a problem, more of an efficiency issue) is that i have to manually keep dragging my avs files onto the bat to start the process. Would it be possible to have the bat file convert a whole directory of videos (maybe 20 or so) one after the other in an automated way?
The .avs file is always the same for each video except the AviSource() line.
I know i can loop the .bat for the number of videos present, but how do i load in the .avs file having a variable AviSource()?
How could i achieve this, or is it not possible?
Thanks.

Related

Batch file to Drag and Drop files to convert via FFMPEG

this is probably my first time ever posting on stack overflow.
I have successfully installed and tested ffmpeg.
Now I want to create a batch file where I can drag and drop my .mp4 or .mkv files to convert to .mp3.
I have no experience with ffmpeg or what parameters to use (the test was a copy/paste with the correct file names filled in) and I haven't touched batch scripting in a long time.
Here is the batch script I found online that kind of works but gives me issues.
#echo off
Pushd "Filepath"
for %%a in (*) do (
ffmpeg -i "%%~fa" "%%~na.mp3"
)
pause;
Batch file is stored on usb drive, along with the shortcut to it (also stored in same folder). The reason for the shortcut is to be able to run the batch as admin once a file is dropped in. The mp4 file is also stored on the same usb in the same folder.
Things are starting to get kind of complicated, and a little above my pay grade.
If anybody has solutions please let me know, maybe the batch script I stole off the internet is wrong.

Quickest way to create a .bat file (as .txt)

I have a couple lines of code in a batch file in Windows 10 that open a session of Octave, and load a script that uses design parameters contained in a .txt file. The batch file is named (for example) "Design123.bat", and when Octave runs, it automatically finds the design parameters in the file "Design123.txt" by simple string manipulation of the file name, i.e. strrep(filename,".bat",".txt"), where filename = '%~dpn0' is passed to Octave from the batch file. This allows for the contents of the batch file to stay simple and constant, and the file name of the batch file is the only thing tying it to the .txt file.
I do all of this to allow running the Octave script by double-clicking the batch file for convenience, instead of being forced to use the more tedious process of uigetfile in Octave. This works very well, but the catch is that I have to place a copy of the batch file in the same directory with the design (.txt) files (of which there are thousands, but each within their own directory) and give it the same file name to get it to work. Is there a way to quickly create the batch files somehow? The most ideal situation I can think of is to be able to right-click (or somehow select) a .txt design file, and create a batch file (replacing .txt with .bat) and place my lines of code into it.
Any ideas? I have coding experience, but only in software packages like VBA and Octave, not within operating systems themselves, though certainly willing to learn if I could get pointed in the right direction. The design file names follow a distinctive pattern, so they could be filtered easily within an operation on the active "File Explorer" window in Windows 10, if something like that is possible. Thanks in advance.
You might want to compose the answer to your question from calling the script on the right click and running the .m script with command line arguments.
If that fails, uigetfile is certainly not the only method to get file. At the very least you could always copypaste a path string to a folder from explorer to octave function call.
Finally, I guess I'll mention the existence of octave-cli which runs in terminal instead of gui. It might be better suited for running non interactive scripts.

Move files into a jar with a .bat script

Just the title. I'm trying to make a .bat file that moves stuff into a .jar, but I have no idea what to do, or even if it's possible. If it's possible, could I be pointed towards the information that would allow me to create such a .bat file? Thanks.
"A .jar file is just a .zip file with a different extension. Use any zip tool that takes command line parameters like WinZip or 7-Zip, and call it from your batch file passing it the right information in the parameters to add the files. Once you pick your utility app, you can read its documentation to find out what parameters it takes and what order they should be in. (Or more easily, you could just open the file in WinZip or 7-Zip and drag and drop the files in using Windows Explorer and save the time and effort.)" - From Ken White, in a comment
Thank you Ken White, for your answer.
While I do agree not using commands is more convenient, I can't automate moving files without commands or code.
This is a valid answer. But for some reason an arbitrary restriction won't let me mark this post as the answer until two days.

Is it possible to convert an EXE file back to a Bat

A few years ago I made a batch text based RPG and I wanted to go back to it, but I found the EXE of the game but I was wondering if it's possible to revert it back into bat format?
edit: Sorry for the lack of information, A few years ago I used a bat to EXE converter and I'm wondering if I can convert the EXE back into bat format to work on the game again, the EXE was also found on an old cloud of mine so that is the only file present
Well this is possible... the truth is most Batch to EXE converters don't actually convert your code, but instead wrap them in an exe file.. so when you run your exe what its actually doing is placing a copy of your original batch file into your temporary directory and running it from there...
what you need to do is open your user file.. thats the directory that holds your documents and pictures and whatnot.. and at the end of your user directory in the address bar, type..
\AppData\Local\Temp
or %temp% in your command line

Efficiently Download Newer files via FTP (Large amount of files with WinSCP commandline)

I am currently creating a small process that will download any new or updated file from an FTP(not SFTP) location to a local drive. I have written a small batch script along with WinSCP, but it takes FAR too long. There are around 200k files and 16k folders on the FTP. It takes just under an hour to check every file and folder, not including any time downloading any new/updated file. From what I understand, WinSCP compared file modification dates of every single file and folder, which is why it takes so long. I'm not sure where to go from here.
I am using WINDOWS 10.
Is there a better way to go about synchronizing these? Possibly check FTP drive if anything has been changed, if so, find the change and download it? Will post pics of batch if needed.
Thank you!

Resources