Hello, I am very...VERY new to Visual Basic, but I do a lot of Batch scripting. I wanted to take this to a GUI so I am trying out Visual Basic 2008 Express Edition right now.
I have got down the easy part, designing the interface, now the coding is giving me a migraine.
I am trying to take user input in a textbox and make a variable out of it, and then use that variable in a shell script. That's if what I'm trying to do is even possible.
I have a batch scripted:
CODE
@echo off
set /p computername= Enter Computer Name:
c:\temp\psexec %computername% MsiExec.exe /norestart /q /I{35C03C04-3F1F-42C2-A989-A757EE691F65} REMOVE=ALL
This allows me to remove a program silently and remotely across the domain from the specified computer. Now, as for VB, I am using a Form that has Textbox and a Button. I renamed the Textbox to txtInput1. When I double-click on the Textbox I have this code:
CODE
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtInput1.TextChanged
Dim CompName As Object = txtInput1.Text
End Sub
When I double-click on the Button I have this code:
CODE
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Shell("cmd /c set /p CompName c:\temp\psexec %CompName% MsiExec.exe /norestart /q /I{35C03C04-3F1F-42C2-A989-A757EE691F65} REMOVE=ALL
", vbHide)
End Sub
Of course, what I trying to do is get the user's input in txtInput1.Text to substitute the variable CompName in the shell where %CompName% is.
I am a true novice to coding in general except for simple batch commands. Any help to get me in the right direction is much appreciated!