Hi Guys,
I'm new to vb.net, I don't understand why when launching this program with Module1.vb as parameter the instruction File.Exists(CommandLineParameter) returns false ?
Maybe I didn't sleep enough but I really can't see why
Thanks.
I'm new to vb.net, I don't understand why when launching this program with Module1.vb as parameter the instruction File.Exists(CommandLineParameter) returns false ?
Maybe I didn't sleep enough but I really can't see why
Thanks.
VB.NET:
Imports System.IO
Imports System.Diagnostics
Module Module1
Sub Main()
Dim ProcessStartInfo As New ProcessStartInfo
Dim CompilerPath As String
Dim CompilerName As String
Dim CommandLineCommand As String
Dim SourceName As String
Dim SourcePath As String
Dim CommandLineParameter As String
Dim CommandLine As String
CompilerPath = "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\"
CompilerName = "vbc.exe"
SourcePath = Environment.CurrentDirectory()
CommandLineCommand = Chr(34) + CompilerPath + CompilerName + Chr(34)
Console.WriteLine("To compile with " + CommandLineCommand)
Console.WriteLine("Enter the source name to compile in " + Chr(34) + SourcePath + Chr(34))
SourceName = Console.ReadLine()
CommandLineParameter = Chr(34) + SourcePath + "\" + SourceName + Chr(34)
CommandLine = CommandLineCommand + " " + CommandLineParameter
Debug.Print(CommandLine)
:confused:
If Not File.Exists(CommandLineParameter) Then
Console.WriteLine(CommandLineParameter + " " + "doesn't exist!")
Debug.Print(CommandLineParameter + " " + "doesn't exist!")
End If
Try
ProcessStartInfo.FileName = CommandLineCommand
ProcessStartInfo.Arguments = CommandLineParameter
Process.Start(ProcessStartInfo)
Catch Exception As Exception
Console.WriteLine(Err.Number)
Console.WriteLine(Exception.Message)
Console.WriteLine(CommandLineParameter)
End Try
Console.ReadLine()
End Sub
End Module