Here is my VB.Net code :
Dim NameOfFile As String = ""
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
Try
Dim fnPeices() As String = OpenFileDialog1.FileName.Split("\")
NameOfFile = fnPeices(fnPeices.Length - 1)
MsgBox(NameOfFile) 'Here it display the file name correctly
Shell("cmd.exe /c" & "echo NameOfFile & pause") ' HERE, IT WILL EXECUTE BATCH COMMAND (echo NameOfFile & pause)
Catch ex As Exception
MessageBox.Show(ex.Message, My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End If
When it execute shell program, Instead of echoing/displaying the file name it just display the word "NameOfFile", how can i display the actual filename?
Please help and thanks in advance..