I use Wondershare Filmora for video recording and am generally satisfied with it. I have it installed on multiple computers. However, because the installation locations differ and Filmora updates frequently (with the version number, like 14.4.3.11809, included in the installation folder path), and I prefer launching it via a batch file from the command line, I constantly had to modify the version number in the batch file, which was quite annoying. Today, I finally modified the launch script, hoping I won't have to change it again.
Initially, I wanted to handle the detection and execution entirely within the fm14.bat batch file, but after trying for a while, I found it too troublesome. Ultimately, I resolved it using a simpler VBScript.
1. fm14.bat
- Use the command-line interface es.exe of the Everything search engine to find
filmora.exeon the hard drive. - Pass the output found by
es.exetofilmora-exec.vbs.
▼ fm14.bat
@echo off
for /f "tokens=*" %%i in ('es -w -r "^filmora.exe$"') do set FILMORA=%%i
cscript.exe c:\util\filmora-exec.vbs "%FILMORA%"
2. filmora-exec.vbs
- Parse the data passed from
es.exe, look forC:orD:, store the execution path in thefilenamevariable, and finally executefilename.
Dim source, substr, pos, filename
' Argument 1 example: 2025/03/12 10:11 38,008 C:\Users\AccountName\AppData\Local\Wondershare\Wondershare Filmora\14.4.5.11834\Filmora.exe
source = WScript.Arguments(0)
WScript.Echo source
substr = "C:"
pos = InStr(source, substr)
if pos <= 0 Then
substr = "D:"
pos = InStr(source, substr)
End if
If pos > 0 Then
'WScript.Echo "Substring [" & substr & "] index:" & pos
filename = """" & Mid(source, pos, 128) & """" ' Assume path length won't exceed 128 significantly
WScript.Echo "exec " & filename
Set objShell = CreateObject("WScript.Shell")
objShell.Run filename, 0, True ' Run hidden, wait for completion
Else
WScript.Echo "Cannot find substring '" & substr & "'"
End If