Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I have multiple batch files in the format:
@echo off

java -Xms1024M -Xmx1024M -jar jarfilegoeshere.jar

pause


The code to run all of these batch files in a given directory is:
VB
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        For Each f In Directory.GetFiles("C:\Users\me\Desktop\directory", "*.bat", SearchOption.AllDirectories)
            'MsgBox(f)
            Dim psi As New ProcessStartInfo(Path.GetFullPath(f))
            psi.RedirectStandardError = False
            psi.RedirectStandardOutput = False
            psi.CreateNoWindow = False
            psi.WindowStyle = ProcessWindowStyle.Normal
            psi.UseShellExecute = True
            Dim process As Process = Process.Start(psi)
        Next
        Me.Close()
    End Sub


However each cmd window which shows up says it cannot access the corresponding jar file. How can I solve this?
Posted
Updated 20-Dec-15 5:31am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900