Rookie here :) Hoping someone might be able to assist. Long story, however, the short of it is that I need to delete a file using a compiled .exe. I've done a fair amount of VB scripting over the years, however, I'm very new to the VB IDE. The challenge I'm facing is that I build the .exe in VB 2010 Express, double click the .exe that was created and it briefly opens a command window for a split second before deleting the file. Ideally, it would be preferable to have the .exe run silently.
Here's what I've done so far. Opened a new project > console application. Added the following code.
Sub Main()
Dim FileToDelete As String
FileToDelete = "C:\testme123.txt"
If System.IO.File.Exists(FileToDelete) = True Then
System.IO.File.Delete(FileToDelete)
End If
End Sub
Next, I save the project and build it. Then double click on the .exe that was generated and the "C:\testme123.txt" file is deleted. However, as mentioned earlier, a command window opens for a split second.
Any assistance on how I can prevent the command window from opening for a split second would be greatly appreciated.
Don
Here's what I've done so far. Opened a new project > console application. Added the following code.
Sub Main()
Dim FileToDelete As String
FileToDelete = "C:\testme123.txt"
If System.IO.File.Exists(FileToDelete) = True Then
System.IO.File.Delete(FileToDelete)
End If
End Sub
Next, I save the project and build it. Then double click on the .exe that was generated and the "C:\testme123.txt" file is deleted. However, as mentioned earlier, a command window opens for a split second.
Any assistance on how I can prevent the command window from opening for a split second would be greatly appreciated.
Don