Are there any scripts for mpv media player in windows?
Closed this issue · 22 comments
No description provided.
For Installation ?
yes for Installation and auto set PATH environment variable
yes for Installation and auto set PATH environment variable
irm https://raw.githubusercontent.com/Kajal4414/Scripts/dev/Windows/Software/mpv.ps1 | iex
try this
PS C:\Windows\system32> irm https://raw.githubusercontent.com/Kajal4414/Scripts/dev/Windows/Software/mpv.ps1 | iex Downloading mpv...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 671 0 671 0 0 1444 0 --:--:-- --:--:-- --:--:-- 1449
100 425 100 425 0 0 386 0 0:00:01 0:00:01 --:--:-- 386
100 31.1M 100 31.1M 0 0 4830k 0 0:00:06 0:00:06 --:--:-- 5967k
Download successful.
Installing mpv...
Error: The term 'nanazipg' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Press any key to exit...
C:\Program Files\7-Zip\7z.exe
PS C:\Windows\system32> irm https://raw.githubusercontent.com/Kajal4414/Scripts/dev/Windows/Software/mpv.ps1 | iex Downloading mpv... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 671 0 671 0 0 1444 0 --:--:-- --:--:-- --:--:-- 1449 100 425 100 425 0 0 386 0 0:00:01 0:00:01 --:--:-- 386 100 31.1M 100 31.1M 0 0 4830k 0 0:00:06 0:00:06 --:--:-- 5967k Download successful. Installing mpv... Error: The term 'nanazipg' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. Press any key to exit...
C:\Program Files\7-Zip\7z.exe
re-try
mpv should be added to the Path environment variable to use mpv from cmd.
where mpv
setx PATH "%PATH%;C:\Program Files\MPV"
Run this command and restart the terminal. Then verify using the where mpv
, mpv --version
command.
# Test folder
$InstallLocation = "C:\Program Files\MPV"
# To add folder to PATH
$persistedPath = [Environment]::GetEnvironmentVariable('Path', [EnvironmentVariableTarget]::Machine) -split ';'
if ($persistedPath -notcontains $InstallLocation) {
$persistedPath = $persistedPath + $InstallLocation | where { $_ }
[Environment]::SetEnvironmentVariable('Path', $persistedPath -join ';', [EnvironmentVariableTarget]::Machine)
}
#To verify if PATH isn't already added
$envPaths = $env:Path -split ';'
if ($envPaths -notcontains $InstallLocation) {
$envPaths = $envPaths + $InstallLocation | where { $_ }
$env:Path = $envPaths -join ';'
}
# Test folder $InstallLocation = "C:\Program Files\MPV" # To add folder to PATH $persistedPath = [Environment]::GetEnvironmentVariable('Path', [EnvironmentVariableTarget]::Machine) -split ';' if ($persistedPath -notcontains $InstallLocation) { $persistedPath = $persistedPath + $InstallLocation | where { $_ } [Environment]::SetEnvironmentVariable('Path', $persistedPath -join ';', [EnvironmentVariableTarget]::Machine) } #To verify if PATH isn't already added $envPaths = $env:Path -split ';' if ($envPaths -notcontains $InstallLocation) { $envPaths = $envPaths + $InstallLocation | where { $_ } $env:Path = $envPaths -join ';' }
But why 15/16 lines of code? If our work is being done with one line setx PATH "%PATH%;C:\Program Files\MPV"
And your cmds sets the system-wide environment (affects all users) which I don't think is right
how to create Shortcut mpv from Powershell or cmd?
setx PATH "%PATH%;C:\Program Files\MPV"
but automatically there will be duplicate PATH system variables in the user variables like
I checked my local system, but I couldn't find anything like that. However, if you're facing this issue, you can use the command below. This should remove duplicate paths.
[System.Environment]::SetEnvironmentVariable('PATH', (($env:PATH -split ';' | Where-Object { $_ -ne '' } | Sort-Object -Unique) -join ';'), [System.EnvironmentVariableTarget]::User)
how to create Shortcut mpv from Powershell or cmd?
$sh = (New-Object -ComObject WScript.Shell).CreateShortcut("$env:USERPROFILE\Desktop\MPV.lnk"); $sh.TargetPath = "$env:PROGRAMFILES\MPV\mpv.exe"; $sh.Save()
how to create Shortcut from cmd?
and how to add arguments mpv in Shortcut from cmd?
how to create Shortcut from cmd? and how to add arguments mpv in Shortcut from cmd?
Batch scripts alone do not have built-in capabilities to create Windows shortcuts (.lnk
files) directly. They can create symbolic links using mklink
, but these are not the same as shortcuts.
how to add arguments mpv in Shortcut from powershell?
To pass arguments to the target app when creating a shortcut using PowerShell, you can set the Arguments
property of the shortcut object. See this example:
# Create a new shortcut object
$sh = (New-Object -ComObject WScript.Shell).CreateShortcut("$env:USERPROFILE\Desktop\MPV.lnk")
# Set the path to the executable
$sh.TargetPath = "$env:PROGRAMFILES\MPV\mpv.exe"
# Optionally, set the working directory (if needed)
$sh.WorkingDirectory = "$env:PROGRAMFILES\MPV"
# Set any arguments you want to pass to the executable
$sh.Arguments = "--fullscreen --no-audio" # Example arguments
# Save the shortcut
$sh.Save()
Replace --fullscreen --no-audio
with any arguments.
how to add Shortcut to TaskBar and Start Menu from powershell?
how to add Shortcut to TaskBar and Start Menu from powershell?
Start Menu Shortcut
$mpvPath = "$env:PROGRAMFILES\MPV\mpv.exe"; $shortcutPath = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\mpv.lnk"; $wshShell = New-Object -ComObject WScript.Shell; $shortcut = $wshShell.CreateShortcut($shortcutPath); $shortcut.TargetPath = $mpvPath; $shortcut.Save(); Write-Host "Shortcut created in Start Menu:" $shortcutPath
Reference for pin to taskbar https://github.com/Atlas-OS/Atlas/blob/main/src/playbook/Executables/TASKBARPINS.cmd
setx PATH "%PATH%;C:\Program Files\MPV"
but automatically there will be duplicate PATH system variables in the user variables like
I checked my local system, but I couldn't find anything like that. However, if you're facing this issue, you can use the command below. This should remove duplicate paths.
[System.Environment]::SetEnvironmentVariable('PATH', (($env:PATH -split ';' | Where-Object { $_ -ne '' } | Sort-Object -Unique) -join ';'), [System.EnvironmentVariableTarget]::User)
🙄
but if use setx PATH "%PATH%;C:\Program Files\MPV"
there are duplicates like this in user variables
without use setx PATH "%PATH%;C:\Program Files\MPV"
C:\Users\username\AppData\Local\Microsoft\WindowsApps
aftar use setx PATH "%PATH%;C:\Program Files\MPV"
C:\Users\username\AppData\Local\Microsoft\WindowsApps;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%SYSTEMROOT%\System32\OpenSSH\;C:\Program Files\MPV