Batch file to Drag and Drop files to convert via FFMPEG - batch-file

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.

Related

Delete file from C:\Windows folder

I'm working with an application that was poorly designed. When installed, it creates a .INI file (remember those?) in the C:\Windows folder. In order to get things working correctly in our environment, I don't use that .INI file. Instead, I have separate .INI files in a different location where I can properly management them within the framework of the application. The problem I'm running in to is users not running the application correctly so it picks up this default .INI file that doesn't work in our environment (remember I said the application is poorly designed).
To make sure that my users are running the correct configuration, I need to delete this pesky .INI from the C:\Windows folder. I have .BAT files that manage application launch and updates so I tried to just issue a delete in the .BAT file but it isn't working. When I try to run just the delete command in a command window, I get "Access Denied". I can't rename it or move it either. I would just go touch each computer but don't have the time to get to them all.
I have just spent the last two hours googling to find a solution and the only solutions are to use Windows Explorer which isn't an option. I know it has to be something simple that I haven't been able to find. Ideas?
for /f "usebackq delims=" %A in ("%userprofile%\Desktop\ComputerName.txt") do echo Del \\%A\C$\Windows\file.ini
Computername.txt is one computer per line, names or addresses.
127.0.0.1

Creating a C executable to run a installer

I'm looking to do a mass update on a large number of computers and would like to create a simple script that i can just click and run to complete the work much quicker.
I've never tackled anything like this before so im not really sure where to start.
The goal of the script is to take the files which i will be moving from a drive to each laptop, open cmd.exe execute a command and then run the installer that is generated from it. Any advice or pointers on where i can start would be greatly appreciated.
I can't comment yet so --
As other users have mentioned powershell would be a better alternative to C. Or you could use a batch file.
#echo off
XCOPY <source path> <destination path> /f /-y
start <your program.exe>
When copying it would display the locations it's copying to and from(/f), as well as as for confirmation for overwrites(/-y).
More switches can be seen here for the copy command.

Is there a way to use a batch file to play a mp4 in a directory

Im trying to find a way so i can get task scheduler to open a batch file and, to play a video at a specific time of day, but the video changes everyday, but is in the same directory. Im sure i can get a way so it's the only video in the directory when the command is run. Im using windows 10 and would not mind using mac os or linux
Thanks!
Sure, your batch file can call windows media player, but it may be easier to install VLC. Then have your batch file call
vlc c:\directory\myvideo.mp4
If the file name might change, but you're sure it's the only file in the directory, then do this:
for /r %%i in (*) do vlc %%i
I believe vlc has a --fullscreen argument. Make a scheduled task to call the batch file. Season to taste.

Open a .bat file, out of a folder, off a flashdrive

I have a game that I'm making off of my flashdrive, and I'm trying to make a save feature into an RPG game. I know I can just save all the data into a character bat file, and then call that bat file, but the problem is that my flashdrive looks cluttered whenever multiple characters get formed. understand? I need to beable to load a save, from a character folder (for organization) from a changing source folder, (Because the flashdrive will be in different USB ports, such as :E or :F etc.)
You can determine the drive that a Windows batch file uses by using the CMD variable substitutions. Within a batch file, you can determine where the file resides.
%~d0 is the drive. %~dp0 is the directory. And there are more.
See What does %~dp0 mean, and how does it work?

Copy files automatically from usb to specific folder with specific extensions

I have huge amount of flash drives and I need to backup my files on specific folder (for example C:\Backup).
There are two problems :
1. I need to backup files with .doc and .docx extension only.
2. When flash drive is inserted, I want that files would copy automatically.
(It's loop if I remember)
Is there any batch solution for this?
try this tutorial for autoplay USB
Then, i am thinking, instead of the autoplay.exe you can set it to run a batch file instead.
In that batch file use the xcopy command.

Resources