Why does a batch file run when I create it in Notepad, but not when I create it in my VB code?
Dim strStartFile As String = "C:\Documents and Settings\All Users\StartMenu\Programs\Startup\Starter.bat" If Not File.Exists(strStartFile) Then Dim strBatLine1 As String = "cd C:\Progra~1\Applic~1 && start Application.exe" My.Computer.FileSystem.WriteAllText(strStartFile, strBatLine1, False) SetAttr(strStartFile, FileAttribute.Normal) End If
It creates a file just fine. It looks exactly the same as the manual version, it just does not start exe with a double click. I tried adding CR + LF, vbCrLf, but did not go.
When trying to run exe directly from Startup, there is some problem, it starts it from this directory and cannot find related files (in the application directory), therefore cd is needed.
Using VB 2010 Express. Thanks in advance for your help!
source share