C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Next: When this program executes, the C:\procexp.exe program will be started and brought to focus on the computer.
VB.NET program that uses Shell function
Module Module1
Sub Main()
' Run this specific executable on the shell.
' ... Specify that it is focused.
Shell("C:\procexp.exe", AppWinStyle.NormalFocus)
End Sub
End Module
Here: This command line compresses all the text files on the C volume into a file called files.7z.
7-Zip Command-LineVB.NET program that runs 7za.exe in Shell
Module Module1
Sub Main()
' Run the 7-Zip console application to compress all txt files
' ... in the C:\ directory.
Dim id As Integer = Shell("C:\7za.exe a -t7z C:\files.7z C:\*.txt")
Console.WriteLine(id)
End Sub
End Module
Output
1296
7-Zip (A) 9.07 beta Copyright (c) 1999-2009 Igor Pavlov 2009-08-29
[Output truncated]
Also: You could use Microsoft Word or other applications located on the disk to open files.
VB.NET program that uses notepad to open file
Module Module1
Sub Main()
' Use the notepad program to open this txt file.
Shell("notepad C:\file.txt", AppWinStyle.NormalFocus)
End Sub
End Module
Finally: It throws exceptions when files are not found, which can be handled in your program as well.