Shell Command Launches An App Differently Than Running The Executable

Sep 1, 2009

I have a legacy vb6 application that uses a shell command to launch a newer .net application. It's a very simple command, just launches an app. Here's the problem. When I run the .net app through the shell command, it tries to connect to a database that is not referenced in it. If I double-click the .net executable, it runs just fine and connects the way it is supposed to. Normal, no problems. Only when I run it from the shell command do I have problems. I have checked everything I can think of and simply can not come up with a reason why the app would behave differently when launched from a shell command.

View 3 Replies


ADVERTISEMENT

VS 2005 Running Fortran Executable Using 'Shell'

Apr 14, 2009

I have an old Fortran program that I've compiled to a windows executable. On opening this from an explorer window the executable runs fine, however on using Shell to run the program a traceback error occurs. Just to be sure I used Shell to open a batch file which runs cmd /K ...exe Why is it that on double-clicking the batch file it will run the executable correctly, however on calling it from my visual basic (very simple button) program the batch file opens the command prompt just fine but does not execute the whole Fortran code successfully? Incidentally I have found that the error occurs on a line to do with reading from a file; it can print to the command prompt etc. with no problems just not deal with the reading the external text file for some reason. By the way paths for files etc. are definitely correct. It makes no sense to me, but from a bit of research it may have something to do with correcting the read statements - at the moment they are just in the form: read(99,*)

View 1 Replies

Create A Command Button That Launches An Email From Outlook Attaching The Current Word Document To A Set Email Address?

Mar 15, 2012

What I would like to do is create a command button that launches an email from outlook attaching the current word document to a set email address. I'm not fussed if the word document is saved or not as it is only the email receipent that needs it, likewise I don't mind if the code instructs the email to send of just opens it ready to be sent.I have read through loads of forums and tried loads of codes but cannot get any to work.

View 3 Replies

IDE :: Get Executable Running?

Jan 13, 2011

Firstly I'm not a programmer and do not pretend to be one. I just enjoy killing some spare time I've been usining Visual Basic (started with VS2005 and now onto VS2010) to develop a program. Up until now I've been happy to plod along running the progam from the development environment. However, I recently was asked by an colleague if they could have a copy of the program to use.Therefore I opted to create an executable file for him to use. The problem is that whislt the executable file runs fine on my machine (Win 7) where VS2010 is installed, it does not deploy correctly on his machine (XP pro). Following is the message that I get:See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

[Code]...

View 2 Replies

Get The Output Of A Shell Command?

Jan 10, 2012

I have a VB.net program in which I call the Shell function. I would like to get the text output that is produced from this code in a file. However, this is not the return value of the executed code so I don't really know how to.

This program is a service but has access to the disk no problem as I already log other information. The whole service have multiple thread so I must also make sure that when the file is written it's not already accessed.

View 3 Replies

Running Executable Within Program?

Aug 5, 2009

I'm trying to run a program (mame.exe) within a vb program. Mame is a program that allows you to run old video games. The games are stored in rom files. If you want to run mame.exe from a dos prompt, the syntax is "c:/mame.exe [rom]". The [rom] is the particular game you are running. I'm trying to create a front end menu from which I can execute games.

I've tried:

Process.Start(
"c:/mamefiles/mame.exe [rom]")

and I get an error that says it can't find the file.

I tried

Process.Start(
"c:/mamefiles/mame.exe", "[rom]")

and it seems to start the program but immediately shuts down mame.I tried

Shell("c:/mamefiles/mame.exe [rom]")

and again it seems to start the program but immediately shuts down mame.

View 8 Replies

Capture Text From A Shell Command?

Jul 14, 2010

So the app that I am working on requires me to launch shell commands that output text into a command prompt window. I need to be able to capture that text into a string.

View 3 Replies

Determine If There Is An Error When Using The Shell Command?

Mar 11, 2010

I'm using a VB.net process to shell another exe process (which will wait until completion before processing is continued in the main app); however, I need to know if there is an error in the shelled exe process before continuing in the main app.

View 2 Replies

Double Quotes Within The Shell Command?

Feb 13, 2012

I'm trying to run batch files code within Visual Basic. I've been told you can do this using the Shell command, however I'm running into trouble with double quotes.As the Shell command syntax is Shell("codecodecode"), I'm not sure what to do when the batch file already contains quotes.

For example, how would I use the code:

copy "file location" "destination"

View 9 Replies

Excute Shell Command Upon Exit Of App?

Mar 31, 2012

I know this is simple but if I want to run a shell command upon termination of the application,

where do I put the code?

I have multiple shell statements, give code example if you can

View 11 Replies

Execute Shell Command With .net Variables?

Apr 21, 2011

I am trying to execute a shell command with vb.net that includes variable from the vb.net code.I have experience with batch, and Unix scripting. I had to modify the contents of the code as it is confidential to me at the moment.Example of my problem:

Dim Variable1 As String = "Location_to_.exe"
Dim Location As String = "UNC_Path_Goes_Here"
Dim Options As String = "/Options go here"

Shell("cmd.exe", /C Variable1, Location, Options) This is something that must be run from CMD.exe and I am trying to do it this way to make it as dynamic as possible.

View 3 Replies

Hide A Shell Command Window?

Jun 6, 2006

I have the below code in a VB Console project. The AppWinStyle function is not hiding the window as expected?[code]...

View 3 Replies

Open A .py File In Command Shell Through VB?

Mar 17, 2010

I know the "Process.Start" function, but it creates a new object of the cmd shell which terminates itself when the Python script is at its end. How can i open the original Windows Command Shell so that the Python file can run to its end without the box getting closed?

View 6 Replies

Repeat A Shell Command Every 10 Seconds?

Jan 27, 2011

Just wondering how can i repeat a shell command every 10 or so seconds

View 6 Replies

Syntax For Shell Command With Parameters?

Sep 9, 2009

I am trying to setup a variable in VB, which will execute a shell command (autostatus.exe) with a parameter (-j JobName), and later display the output of the said variable. The code thus far is...

Dim JobName
Dim JobStatus
JobName = "asysr11_set_global_var_2day"
JobStatus = ShellExecute("autostatus.exe", -j, JobName)

What is the easiest way to achieve this? Currently, the above code returns error message "line:4, Type mismatch: 'ShellExecute', code: 800A000D"

View 1 Replies

Executable Directory Where Application Is Running From?

Apr 7, 2010

I need to get the path (not the executable) where my application is running from:System.AppDomain.CurrentDomain.BaseDirectory()

View 3 Replies

Running A VB2005 Executable On Any Windows OS?

Mar 14, 2011

Can a VB2005 executable created from VS2005 run on any Windows OS (vista, 7)? If not what is the "patch"?

View 1 Replies

Running EXE In A Shell And Then Reading The Output?

Apr 17, 2010

In the code below - when I try to read the contents of the text file that I've created by using the > in the shell command, I only get the first character of the file - not the whole contents!I've put breaks in the code and checked the contents of the file immediately after the shell command and the file is complete. I can't understand how I'm only getting one character of this text file.

Private Sub myButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles myButton.Click
Dim runEXE
Dim path As String = pathTextBox.Text
path = Replace(path,"Program Files", """Program Files""")

[code]....

View 9 Replies

Pass Command Line Parameters Through The Executable

Mar 5, 2009

I'm currently creating a new process and then executing an executable from a specified location:

[Code]...

View 4 Replies

Adding Variable In Shell Command In Quotes?

Nov 15, 2011

I have a visual basic shell command that installs an IPP printers with a shell command. It asks for the username for the port.
userport = username.Text

How do I Incorporate that into:
Shell("rundll32 printui.dll,PrintUIEntry /b ""AT-LAB-BWQ"" /if /f %windir%inf
tprint.inf /r
""[URL]"" /m
""HP Color LaserJet 2800 Series PS"" /z /u")

View 3 Replies

Command Line To Close Shell Process?

Mar 12, 2011

I've created a very basic WF Shell project which runs an EXE (xyz.exe) in the WF Shell project's Resource folder. I can get a command line working from the Shell to open the other EXE (xyz.exe). But, I can't get code to close the Shell project's other EXE (xyz.exe) once it is opened. The xyz.exe windows called by the Shell continues to stay open even if I pass a "close" command line to the Shell.

The following code (which Paul suggested in another posting) will not close the other (xyz.exe) EXE's running process (when called by the Shell). While the Shell seems to be able to return it's called subordinate EXE's (xyz.exe) ID, not sure how to use such an ID to close its process.

Imports System.Diagnostics
Module Module1
Dim resourceFolder As String = Application.StartupPath & "Resources"

[code]....

View 2 Replies

Control Panel Applets - Shell Command?

Jan 21, 2009

I've researched this - and have read the other posts on this forum so this isn't a request for the commands themselves.My issue is that I can't get the 'desktop background' (to change the picture) applet to run from the following:Call Shell("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0", 1)

what I get from changing the commands are the following:Desktop Icon Settings Call Shell("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0", 1)

Screensaver Call Shell("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,1", 1)

Appearance settings Call Shell("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,2", 1)

Resolution settings Call Shell("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,3", 1)

If I increment up from 3 (desk.cpl,,3) to 4,5,6 etc it still only gives me resolution settings. I tried up to 15 but lost the will to live after that! I'm using Vista (and VB 2008) so not sure if this is the issue, but if anyone has any suggestions please - I'm all ears.

View 1 Replies

Execute Shell/Command-line Script From .NET?

Jul 28, 2011

I'm using the following code to execute a command-line script, which uses imagemagick (a third-party, free, image tool) to create a watermark. (And then I run a similar command to attach the watermark to my image.)What I need, though, is to be able to receive the RESPONSE/RETURN CODE from the execution...it seems to sometimes fail.

[Code]...

View 1 Replies

Quest AD Management Shell Command & 2005?

Jun 28, 2010

Is there any way i can run a Quest AD management shell command (not a plain powershell command) from Vb 2005 ? i mean do i need to register a snap-in within vb or register a dll or something ?for eg. i need to create a simple script to add multiple users to multiple groups then i can quickly design the front end in VB with 1 textbox for users & 1 for groups & then in background can i run a quest ad management shell command to actually add the groups (using add-qadgroupmember in this case)

View 3 Replies

Run A Shell Command And Return Success Or Fail?

Jul 30, 2010

I searched around and could not find a solution so I am sorry if I started something that has already been covered. Want I want to do is run a command line code and simply return a boolean of if it was successful or not. Is this possible? Typically when you run something (example net user User Pass) it will return a value "The command Completed Successfully." If I return this value I will have it from there.

View 10 Replies

Simple Button That Executes A Shell Command

Oct 24, 2011

I haven't touched VB or Visual Studio in an incredibly long time, so I appologize if this sounds ignorant.

Right now, my application (pictured below) is a simple button that executes a shell command. I was thrilled that I even managed that, but it got me to wondering if my application could execute that command, rather than sending the process to cmd.exe.

View 4 Replies

Single Command Shell (cmd.exe) In Interactive Form?

Jun 17, 2011

I would like to have the single command shell, aka cmd, in my app within a form in an interactive way.

View 6 Replies

Check Creation Date Of Executable That Is Currently Running

Jun 9, 2009

I would like to implement into my program a version query of the executable and I figured the easiest way would be having a check on the date of the executable. So how can I check the creation date of the executable that is currently running (from the program itself that is)?In short - double click on .exe and it will tell the date of its creation

View 10 Replies

Running An Executable Application .net Version Lower Than 4?

Jul 13, 2010

It appears that the executable application I created can only be run on a computer with .net 4. How can I compile/create the executable to run on a computer with .net 2?

View 3 Replies

Open An Excel 2007 File Using A Shell Command?

May 13, 2011

i am trying to open a excel 2007 file using a shell command in visual studio .net 2008 from a button object but it says "File Not Found" even though I created the file and put it into the same folder as the application.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved