How can I write a batch file that opens a file in a program?

bumblebur

New member
Local time
10:51 PM
Messages
4
I wrote this batch file which does what I want it to do so far.

Code:
@echo off

"C:\Users\xxxxxx\Documents\HideTaskbar\HideTaskbar.exe"
"C:\Program Files (x86)\VideoLANold\VLC\vlc.exe"
"C:\Users\xxxxxx\Documents\HideTaskbar\ShowTaskbar.exe"

exit

VLC is a video program so I want to associate video files to this bat file. This would mean that when i clicked on a video file in Windows Explorer, the bat file would execute and VLC would open the file I double clicked. At the moment the only thing that happens in this setup is that the bat file executes like normal but no video is played.

Is this possible, and if so how can I accomplish it?
 

My Computer

Computer type
PC/Desktop
OS
windows 7

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
home built
OS
Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64 +Linux_VMs +Chromium_VM
CPU
AMD Athlon II x4 620
Motherboard
Gigabyte GA-MA785G-UD3H
Memory
6GB GSkill DDR2 800
Graphics Card(s)
AMD 4670 GPU + AMD 4200 IGP
Sound Card
on board Realtek ALC889A
Monitor(s) Displays
RCA 40" LCD TV, Insignia 32" LCD TV, HP 15" LCD monitor
Screen Resolution
1680 x 1050
Hard Drives
OCZ Vertex 3 120GB,
Samsung F3 1TB (3),
Several others - WD, Seagate, Hitachi, ...
PSU
Corsair 500 W
Case
Rosewill mid tower
Cooling
CM 90mm rifle
Keyboard
Gyration wireless, Logitech wireless, Dell USB wired
Mouse
Gyration wireless, Logitech wireless, V7 USB wired
Internet Speed
Spectrum - 100Mbps D / 10Mbps U
Antivirus
Avast, MBAM3, EMET, WinPatrol
Browser
Pale Moon, Firefox, IE
Other Info
2 multi-boot PC's
Mainly HTPC/Office/Gen purpose (no gaming).
Trendnet USB KVM.
LG DVD burner/Blue Ray Player.
Tray system for removable SATA backup drives.

Not currently OCd, under-volted.
I use Hybrid sleep, rarely re-boot or shutdown.

Hauppauge HD-PVR, Avermedia PCIe TV Tuner, Hauppauge PCI TV Tuner.

My Computer

Computer Manufacturer/Model Number
Put together
OS
Win7 Pro-64 Bit
CPU
i7-2600-3.4GHz
Motherboard
ASRock Z68M
Memory
8 GIG DDR3
Graphics Card(s)
onboard
Sound Card
onboard
Hard Drives
Seagate 1TB 7200RPM
PSU
680 W
Case
black
Cooling
stock fans
Keyboard
Microsoft
Mouse
Microsoft optical
I've had VLC associated with these files for a long time but now I need some added functionality.

I want the other two programs to run as well

The hidetaskbar program runs at the same time as vlc in this batch file and then when i close vlc the last program runs which is perfect. The only issue right now is that when I associate a video file with the batch file, it doesn't pass this file to VLC which means that VLC opens but the selected file doesn't start playing.
 

My Computer

Computer type
PC/Desktop
OS
windows 7
Old school method:
call "C:\Users\xxxxxx\Documents\HideTaskbar\HideTaskbar.exe"
call "C:\Program Files (x86)\VideoLANold\VLC\vlc.exe"
call "C:\Users\xxxxxx\Documents\HideTaskbar\ShowTaskbar.exe"
 

My Computer

Computer type
Laptop
OS
win7 64bit Ult. using: XP Mode, in English or Español, SUA, Bitlocker
Memory
8GB - included when purchased.
Monitor(s) Displays
two: Laptop: 1366x768 and HP 1024x768.
Hard Drives
1: 750GB
Keyboard
Second: PS2 connection Compaq kboard, used w/adapter cable.
Mouse
USB mouse.
Antivirus
MS Security Essentials
Other Info
XP Mode Apps used: VC6 C++ and MSDN help as virtual PC apps - one for ea. monitor.
Tri-boot machine. Has Ubuntu 12.04 and Win 8.0 on as well - both used seldomly.
Old school method:
call "C:\Users\xxxxxx\Documents\HideTaskbar\HideTaskbar.exe"
call "C:\Program Files (x86)\VideoLANold\VLC\vlc.exe"
call "C:\Users\xxxxxx\Documents\HideTaskbar\ShowTaskbar.exe"

I've given this a shot. It doesn't solve the issue unfortunately. When I go into Windows Explorer, associate the video files with the bat file and click it... it opens up all three programs in order but vlc doesn't play the file.
 

My Computer

Computer type
PC/Desktop
OS
windows 7
It does what it's supposed to- start up Vlc.exe.

I'm not sure, but if you're trying to make vlc.exe do something, try putting a filename after it, with a one space separator after vlc.exe.

It's not really the way to do it these days, as there are playlists for this purpose... But if you want to, you can specify one file on a line as described. This is called hardcoding.

Then you can make for example 10 vlc.exe lines, with 1 different video/music file after each one (complete with it's full folder path). This is possible, and it will work. It's a bit cumbersome. You probably want to figure out how you can make a playlist instead....
 

My Computer

Computer type
Laptop
OS
win7 64bit Ult. using: XP Mode, in English or Español, SUA, Bitlocker
Memory
8GB - included when purchased.
Monitor(s) Displays
two: Laptop: 1366x768 and HP 1024x768.
Hard Drives
1: 750GB
Keyboard
Second: PS2 connection Compaq kboard, used w/adapter cable.
Mouse
USB mouse.
Antivirus
MS Security Essentials
Other Info
XP Mode Apps used: VC6 C++ and MSDN help as virtual PC apps - one for ea. monitor.
Tri-boot machine. Has Ubuntu 12.04 and Win 8.0 on as well - both used seldomly.
Instead of mucking with hiding/unhiding the taskbar when you start VLC, why don't you just change the settings in VLC to start fullscreen? This will automatically hide the taskbar when running VLC and automatically restore it when exited.

vlc.png
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Home Built desktop, Dell G15 5511 Gaming laptop,MS Surface Pro 7 tablet
OS
W10 Pro desktop, W11 laptop, W11 Pro tablet (all 64-bit)
CPU
3.7Ghz 8700K i7, i7-11800H, i7-1065G7
Motherboard
ASUS TUF Z370-Pro Gaming in desktop
Memory
16G desktop, 16G laptop, 4G tablet
Graphics Card(s)
AMD Radeon RX580, RTX 3060, Intel Iris Plus
Sound Card
High Definition Audio (Built-in to mobo)
Monitor(s) Displays
Samsung U32J59 32" (2x), 15.6", 12"
Screen Resolution
3840x2160, 3840x2160, 1920x1080, 2160x1440
Hard Drives
500G SSD for OS; 2T, 10T & 15T HDDs for Data on Desktop, 1TB SSD laptop, 128G SSD tablet.
PSU
Corsair CX 750M
Case
Antec 100
Cooling
CM 212+
Keyboard
IBM Model M - used continuously since 1986
Mouse
Microsoft Pro IntelliMouse
Internet Speed
400M down 8M up
Antivirus
Windows Defender
Browser
FireFox
Other Info
Built my first computer (8Mhz 8088cpu, 640K RAM, 20MB HDD, 2 360K floppy drives) in 1985 and have been building them for myself, relatives and friends ever since.
Add %* after the call to VLC. That will pass all parameters given to the bat fil onto VLC>

@echo off
"C:\Users\xxxxxx\Documents\HideTaskbar\HideTaskbar.exe"
"C:\Program Files (x86)\VideoLANold\VLC\vlc.exe" %*
"C:\Users\xxxxxx\Documents\HideTaskbar\ShowTaskbar.exe"
exit
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo IdeaCenter 450
OS
Windows 10 Pro X64
CPU
Intel Quad Core i7-4770 @ 3.4Ghz
Memory
16.0GB PC3-12800 DDR3 SDRAM 1600 MHz
Graphics Card(s)
Intel Integrated HD Graphics
Sound Card
Realtek HD Audio
Monitor(s) Displays
HP 22" LCD
Screen Resolution
1680 x 1050
Hard Drives
250GB Samsung EVO SATA-3 SSD
2TB Seagate ST2000DM001 SATA-2
1.5TB Seagate ST3150041AS SATA
Keyboard
Dell USB
Mouse
Lenovo USB
Internet Speed
Cable via Road Runner 3MB Upload, 30MB Download
Antivirus
Windows Defender, MBAM Pro, MBAE
Browser
Seamonkey
Other Info
UEFI/GPT
PLDS DVD-RW DH16AERSH
Add %* after the call to VLC. That will pass all parameters given to the bat fil onto VLC>

@echo off
"C:\Users\xxxxxx\Documents\HideTaskbar\HideTaskbar.exe"
"C:\Program Files (x86)\VideoLANold\VLC\vlc.exe" %*
"C:\Users\xxxxxx\Documents\HideTaskbar\ShowTaskbar.exe"
exit

Wow this is nearly perfect. Thank you sir! The only thing off is that while the video is playing, a cmd.exe command window stays open and then closes when I close VLC. It'd be nice if that cmd window closed before VLC opened.
 

My Computer

Computer type
PC/Desktop
OS
windows 7
The command window is waiting for vlc to finish so it can't close.

You can get a windowless VBS script to do the same thing. Make a text file containing the following and call it RunVLCNoTaskbar.vbs or something similar and associate with your video files.
Code:
Set oWSH = CreateObject("WScript.Shell")

s = ""
for a = 0 to WScript.Arguments.Count - 1
  s = s & " " & WScript.Arguments(a)
next

Call RunWait("C:\Users\xxxxxx\Documents\HideTaskbar\HideTaskbar.exe")
Call RunWait("""C:\Program Files (x86)\VideoLANold\VLC\vlc.exe"" " & s)
Call RunWait("C:\Users\xxxxxx\Documents\HideTaskbar\ShowTaskbar.exe")

WScript.Quit

' ***
' *** Function Definitions
' ***

Sub RunWait (sTestEXE)
    Dim oExec
    Set oExec = oWSH.Exec(sTestEXE)
    Do While oExec.Status = 0
        WScript.Sleep 100
    Loop
End Sub
 

My Computer

Computer type
PC/Desktop
OS
Windows 7 Enterprise x64

My Computer

Computer type
Laptop
OS
win7 64bit Ult. using: XP Mode, in English or Español, SUA, Bitlocker
Memory
8GB - included when purchased.
Monitor(s) Displays
two: Laptop: 1366x768 and HP 1024x768.
Hard Drives
1: 750GB
Keyboard
Second: PS2 connection Compaq kboard, used w/adapter cable.
Mouse
USB mouse.
Antivirus
MS Security Essentials
Other Info
XP Mode Apps used: VC6 C++ and MSDN help as virtual PC apps - one for ea. monitor.
Tri-boot machine. Has Ubuntu 12.04 and Win 8.0 on as well - both used seldomly.
Back
Top