Executing Shell Commands From String?
Feb 6, 2011how can i execute a shell command from a string
shell("cd", StringName)
the string comes from a user entered textbox
StringName = Textbox.text
how can i get this to work?
how can i execute a shell command from a string
shell("cd", StringName)
the string comes from a user entered textbox
StringName = Textbox.text
how can i get this to work?
I need to execute the following commands from my application:
Echo Y | DEL C:Folder1cache*.*
DEL C:Folder1file.abc
DEL C:Folder1file.xyz
[code].....
Here's an example code so you can understand my problem:
Dim test1 As String
Dim test2 As String
Dim test3 As String
[code]....
shell.Run("""testProgram""test1 test2 test3 test4") 'I know this is wrong.My problem is in the last line. I want the contents of the strings to be printed, not the names of the strings, and I don't know how to do that.
I am trying to execute the shell script in vb.net.[code]...
The script doesn't create the outfile mentioned in -out switch. The path mentioned is correct and also the command with switches is correct. It runs well in command prompt but not in the program. [code]...
how do i run my shell Shell("netsh interface ip set address" & Chr(34) & "Local Area Connection" & Chr(34) & "static 10." & IPAddy & ".4") as admin?
View 2 RepliesI have some code in Form Load event. It is doing fine. But when it reaches to pick data from database, no commands are executing after that. There is no error at all but it just goes silent.[code]...
View 3 RepliesI cant understand why this works (Start a service "test" on a remote computer):
Dim rCommand As String
rCommand = "c:pstoolspsservice \computer -u admin -p blabla start test"
Shell("cmd.exe /c" & rCommand)
[Code]....
The above code that doesnt work starts a virtual machine on VmWare Server. I have the exact same line in a .bat file and if i call the batfile from VB it starts the batfile and execute the commmand. I cant understand why this doesnt work without the batfil when i have no problem executing the PsTools command from VB-code.
[Code]...
for exp. this the code that i use to open calculator but how can i use , appminimize, maximize, apphide, normal, show etc. command that i can use in visual basic ?
Sorry if i had make about tags.
Okay, heres the deal...I need to open up a cmd prompt, then run a file called adb.exe which opens a shell to communicate with my android cell phone...
My Form1
Code:
Label1.Text = "adb.exe shell"
[code].....
I need to open several pdf, word and excel files from process.start like command, but only open one file at time.
View 2 RepliesI'm trying to create a program that does the following:Executes the following command line string (wmic /node:computername bios get serialnumber)Prompts user for the "node" entry Displays the resulting serial number in a dialog box I'm a bit of a noob at this (I haven't coded anything in VB since early 2000s) so I'm at a bit of a loss where to start. I plan on including some functions to submit the node entry and the resulting serial number to a database in the future for archiving as well.
View 4 RepliesI would like to create an application that would shell command prompt, and then passcommands to it.
View 4 RepliesIm trying to create an app that can Compile and run vb.net code while running. Like I will have a multiline textbox and a button that runs the code. The code should run as if it Were to be in a normal Sub. I've heard of system.reflection but all the examples microsoft provided have failed.
View 4 RepliesI'm going to attempt to make a shell replacement for the Windows default shell: explorer.exe. I'm not sure if its possible using Vb.Net, but I can't seem why not. My end goal is to use a custom made shell for a Windows Preinstallation Environment instead of the default command prompt. I plan to use a 3rd party program to compile the program with the .NET Framework. Otherwise, it wouldn't work because Windows PE does not support the .NET Framework.
View 1 RepliesI trying to figure out how to execute commands stored in string, let's say i have string called "command" and a textbox, so i want vb to run command that i typed in textbox, e.g. i type in textbox "label1.text = "bla bla"", and then type like "msgbox.show". Is that even possible?
View 12 RepliesOk I'm creating a sql query with a string variable and executing it in vb. The string would look something like: Insert Into Table (vara,varb,varc) Values ('vara','varb','varc') This works fine.
[Code]...
Tell me older versions of these commands to be used with .NET 1.1?
The pieces of code I am using are:
For reading a text file to a string-
Dim str As String
'reading the content of the file "test.txt" and storing it in the declared variable
[CODE]...
I would like to know please how to check whether a string exists or not in a html code. I'm executing a for loop. Each time it checks a different url, so I want to be able to check each time if for example "<img" exists .
P.S: What's the difference between using
webrowser1.navigate
AND
dim request webrequest
request = WebRequest.Create
etc...
I'm trying to use the Shell to have my application call an external application but its not working...I don't understand why. I get the following error: 'System.windows.shell' is a namespace and cannot be used as an expression!
Heres my code....any ideas what I'm doing wrong. Its got to be a simple...stupid error.
Private Sub mnuUpgrade_Click(ByVal Ctrl As Microsoft.Expression.Web.Interop.Legacy.CommandBarButton, ByRef CancelDefault As Boolean) Handles mnuUpgrade.Click
[CODE].....................
i have this
Quote:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Process.Start("mybatchfile.bat")
End Sub
its working if they are on the same folder,i want to do is make the batch file as a resource file so that i can run it even not in the batchs folder?
I can create a shortcut using this code:
Dim sFolder As String, sTarget As String, sAppName As String
Dim oShell As New WshShell
Dim oShortcut As WshShortcut
[Code]....
I am using Shell Dll to unzip zip file in vb.net 2005. Following is the code for this.
Dim sc As Shell32.Shell = New Shell32.Shell
Dim srcf As Shell32.Folder = sc.NameSpace(src)
Dim desf As Shell32.Folder = sc.NameSpace(des)
[code].....
I want to send messages withing a windows 7 LAN using VB.NET code. The problem is that the msg.exe executes commands in admin mode only. Here is the code. Shell("cmd.exe /k runas /user:farook-pcadministrator msg.exe") 'Here i'm prompted for a password. Shell("cmd.exe /k msg.exe", 1) I use the /k switch to see what's going on in the shell. /c is the silent switch. I do not wish to use runas neither do I wish to change privilages in msg.exe
View 2 RepliesI have an update app, which can be updated itself by another update app (so, the second app is an updater of the main updater). Both apps must have administrator permissions because of writing in the Program Files folder. Is it possible that when the main updater is running (under administrator rights) it can use Shell() to let the second updater run with administrator rights without a UAC confirm dialog popping up again?
View 3 Repliesit possible to have a start command instead of the simple shell the same code as in a .BAT File, i dont know but on a .bat is a higher/lower lvl.
[Code]...
I want to be able to run any command by typing into a textbox.For example if I wanted to get info from "ipconfig".I want to be able to type "ipconfig" into the textbox and for it to then display the infomation into a richtextbox.I have been searching the internet but so far can not find a solution
Code:
Shell("ipconfig", AppWinStyle.Hide)
How do I now display the infomation from the console into a richtextbox?
I want to use Shell function in Vb.Net.Thing is that i have 5 checkboxes. on checking each checkbox i want to execute batch file which fires some commands in database.but while checking all 5 checkboxes all batch file gets executed and then it gives me error.I want to run only one batch file at a time.
View 11 Repliesy question is I have a program that is used to add inputs to an array when the OK button is clicked. My problem is that the after the first click of the OK button the Do while loop does not execute again for a 2nd click.lling out my hair. Here is the code.
Public Class InputValue
Public Shared InputArray(0 To 9) As Integer
[code].....
we want to write a DLL using VB.NET 2008 using .Net 3.5 that performs an HTTP request we then want to call the DLL From SQL Server 2005 (in a trigger) and pass the DLL some variables and get a return value.Where im at in the process.I have created the DLL 'HTTPDLL.dll'
Source:
Imports System
Imports System.Configuration
Imports System.Collections.Generic
Imports System.Text
[code].....
Perhaps i am calling it incorrectly but i havent been able to get it to work (always return 'invalid class string')
Just trying to run a basic program where the user is prompted to enter five names, one at a time. I'm prompted one time. After entering one name I get the following error "Unhandled exception: System.NullReferenceException:Object reference not set to an instance of an object"
Here's the
Module Module1
Sub Main()
Dim SortedList
For SortedList = 1 To 5
[code]....