Command Line Program To End Before Moving Onto The Next Command In Loop?

Feb 4, 2011

I am using a CheckedListBox that is populated with Filenames (full path, i.e. C:TestTest.jpg)When I have the files that I want in the CheckedListBox I wish to click a Start Button which will process the list one at a time using an exe program that runs on the Command Line. There are arguments that need to pass to the command line as well as the file location in order for the program to process.I currently have it working but the issue is the loop finishes quickly and it is left up to the CMD.exe to finish the process. What I would like is for the LOOP to wait until each file completes processing before passing the command for the next file in the CheckedListBox.There some reasons I wish for it to work this way.

1) I would like to have a button that can Pause/Restart the Loop.

2) I would like to have a button that can Stop the Loop so the whole process can end.

3) I would like to have the Loop remove each file one by one from the CheckedListBox after it has been processed.

4) I would like to display a Message once all the files have been processed.

5) And if it were possible I would like to report the status either by text or a progress bar showing where it is at in the process.

6) And the ability to add some error handling if possible.

Since the Loop finishes so quickly as it just passes the command to the command line using the & as a seperator it is the command line that is handling the rest of the process. Because of this there is not control over it in the GUI.The code I am using allows the Command Line text to display in the Form so it won't open up a seperate window to run CMD.exe. This is the desired affect as I would like everything to appear to run from within the Form itself.



Send A Command To A Command Line And Then Submit The Command?

Apr 30, 2010

First let me say that I am not sure whether or not this should go in this section or the API section, and if it needs to be moved I apologize. My issue is fairly straight forward, but for some reason I cannot get it to work.

I am trying to send a command to a command line and then submit the command. I have been trying without success to get this to work in v2008 Express and v2010 Express, Here is the code I am trying to us:

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String _


View 6 Replies View Related

Command Line Argument: Check If Correct Command Line Or Exit App?

Jun 6, 2012

I have beginner skills using VB (am using the Express edition to learn). I would like to know how to set up a conditional statement in a Windows Form (WF) app that would check if a specific command line has been passed by another separate app that launchesthe Windows Form app using command lines, and if not passed, then the Windows Form app would shut down (exit, close).So far, I can use:

For Each s As String In My.Application.CommandLineArgs
If s <> "xyz" Then


View 14 Replies View Related

Command Line Switches - Keeping Command Window Open?

Feb 24, 2010

I am using the following code to run defrag and to analyze if the C: drive requires defragmentation:

Dim analyze As Process = System.Diagnostics.Process.Start("C:WindowsSystem32defrag.exe", "C: /a /h /u /v")

This process runs through analyzing, runs it in normal mode & prints the progress to the command window.

My problem is that as soon as the process is complete the command window closes. I need it to stay open so that I can read the results.

View 3 Replies View Related

Send Command To Command Line From Windows Form Application?

Mar 11, 2010

I am trying to send a command to the external command line (cmd.exe) from the Windows form application that I'm writing in VB.NET (using VS2008).

I can only access the external program thru the command line (its not my program) and I must do so from a form app.

I am trying to use the following code. I am able to call a cmd.exe window, but I can't pass the command line my command.

Using mp As New Process
With mp.StartInfo
.FileName = "cmd.exe"


View 8 Replies View Related

Run A Command Line Program?

Mar 25, 2011

I'm a bioinformaticist, I'm trying to teach myself how to develop programs that are easy for everyday users to automate programs used in biological research. I thought VB would be great for helping people be more familiar with bioinformatics. Unfortunately, I'm brand new to VB and am stuck with my first program.

All I want to do is have a window pop up where the user then selects a file from an OpenFileDialog box, and pass the filename to a bioinformatics program names msconvert. What I've been doing keeps giving me a message that seems to says, "Unhandled exception has occurreed in your application. . . . File not found."

However, as you can see in my code (below) I have a MsgBox that shows that the correct file HAS been selected, and I can get the whole thing to run from command line.[code]....

View 8 Replies View Related

Run A Program With Command Line?

Oct 23, 2011

how can i make my own program must run with command line? if the program run without command line, it show some error msgbox..

View 4 Replies View Related

How To Get Command Line Arguements In .NET Program

Feb 22, 2007

i want to know how to get the command line arguements inside the vb program aka parameters that you specify while running a vb program through a shortcut by specifying a parameter ??for ex: "c:myfile.exe -parameter1 -parameter2 -etc".

View 5 Replies View Related

Make A Command Line Program

Sep 24, 2010

I want to make a command line program BUT I really want to have a call function. I have tried this:


View 2 Replies View Related

Command Line Strings - Make The Program Close If The -1 String Is Sent With The Program

Feb 25, 2010

If e.CommandLine.Count > 0 Then

Dim IncomingCommand As String = e.CommandLine.Item(0).ToString

If IncomingCommand.Substring(0, 2) = "-1" Then


End If

End If

I am trying to make the program close if the -1 string is sent with the program. See my installer allows for me to run certain programs before it actually installs, but it doesn't shut down copies of the program itself. So I have a next startup instance set to shut the program down if the -1 is received. But if the program is not running it starts up instead. This is not desired. form1.close doesn't work. e.cancel = true doesn't work, etc etc. What can I do to make the program not start during this instance.

View 1 Replies View Related

.NET - Pass Command On Command Line?

May 29, 2012

I am struggling to pass a parameter to a VB.NET application via a Windows scheduled task. It works perfectly in Visual Studio (passing a command line arguement via project properties).If I am calling a VB6 application, then I will supply the following parameters and it works:

Run: c:progra~1TestTest.exe TestParameter Start In: c:progra~1Test However, if I supply the same parameters in VB.NET, the program throws an exception when it tries to create an instance of a class in the Form.Load: System.NullReferenceException cannot create instance of object.

I have also tried the following:Run: c:program filesTestTest.exe TestParameter Start In: "c:program filesTest" This time the status of the scheduled task changes to "cannot start".What is the correct way to specify command line parameters in a scheduled task for a VB.NET program?UPDATE I found the solution on this web page:[URL}.. I am still confused as to why the program would not create an instance of an object when I used the 8 bit paths (i.e. progra~1)

View 1 Replies View Related

Return An Errorlevel To Command Line Through Program?

Sep 10, 2007

How can I return an errorlevel to the command line through VB.NET? I have tried:ExitProcess(0)and Environment.exit(0)

View 5 Replies View Related

Start Command Line Program With Arguments?

Feb 5, 2010

How would I start a Command Line program with arguments?

View 4 Replies View Related

Convert Old GW-BASIC Program To A Command Line Program With Arguments?

Mar 1, 2012

This is going to be a lot to ask, but I'd like to convert my old GW-BASIC program to a command line program with arguments. I'd like it to operate as follows:

elapse [drive:][path]filename This is my old code.

10 OPEN "G:Calc.txt" FOR INPUT AS #1
20 WHILE NOT EOF(1): INPUT #1, A$, B$
30 IF MID$(A$,3,1)=":" THEN C$="DOUBLE DIGIT":GOTO 50
40 IF MID$(A$,2,1)=":" THEN C$="SINGLE DIGIT":GOTO 120


View 3 Replies View Related

Can't Save File Using A Command Line Program Using New Process

Oct 7, 2011

I have been trying to fix this and make this work for pretty much three days now. I already solved one problem being, I can't use the shell on one HDD and create another file onto a different drive other then the drive that the directory of the application is running in.


If I run a program that is on the C: drive and using a working directory that is on the C: drive, I can not create a file onto the F: drive.

I got this problem when I was just using Shell(Environ$("Comspec") & " /c  then the command")

So I decided to use Process()

Dim p = New Process()
p.StartInfo.FileName = "F:Visual Basic ProjectsCode TestingCode TestinginDebugToolsMediaInfoMediaInfo.exe"


View 2 Replies View Related

Command Line (console) Program With Parameters For SharePoint?

Oct 29, 2009

I would like to create a console program in that would allow parameters. What i would like to do is in the code below add parameters so the webpart page can be created from the Run menu. e.g. C:.......MyProgram.exe "Design" --This would then create the Design webpart page.

I tried looking at the internet but was not very successfull.

Module Main
Public Sub Main(ByVal args As String())
Dim prj As String


View 1 Replies View Related

Program Launched From Command Line Versus Clicking

Jan 8, 2010

I'm writing a program in The program can be started from another program by passing some arguments or it can be lauched by clicking .exe. I'd like to show the user some options depending on where he is coming.Is the below approach correct? [code]

View 3 Replies View Related

VS 2008 - Single Instance (Command Line In Program)

Aug 6, 2011

I use a single instance in my application. What if I give command line arguments to the exe of my program, so I can be selective in what was given command line in my program, but still single instance?

test.exe /show
When the command /show, then my program will

View 1 Replies View Related

VS 2010 - Developing An Automated Command Line Program - Attach The Timer ?

Feb 15, 2012

The code in question is in place, and it works. The project is all but wrapping up. That being said, I would love to find a better way to run this section of code in an x64 system so I have the solution ready for future projects. What I currently have in place is as follows:

Function TimeDelay(vDelay)
Dim vTimmer, vTargetTime

vTimmer = TimeValue(Now)


Now I know the easy way to achieve my goal would be to use the timer object in Visual Studio. The problem I ran into is I was developing an automated command line program. As such there was nothing I could attach the timer to (that I'm aware of). I just needed to pause the program for a few seconds to allow the DTSX package (SSIS file if you're not familiar) to load the file before I remove it from the staging folder.

While I was doing research for this issue I came across the old Sleep() function (referenced to a library in kernel32 as I understand it...never used this before either). When I tried to use this on my current system (64-bit system) I received stack overflow errors. Additional research lead to something called wow64, but I did not have enough time to fully research what this is / how to use it.

View 4 Replies View Related

VS 2010 Can't Access Files Below Root When Using Process To Run A Command Line Program

Feb 4, 2011

I am trying to create a program that downloads audio files via FTP, converts the audio to mp2 if necessary and copies them to a certain directory for consumption by our automation system. (I am a radio station engineer.)I am using the open source converter FFMpeg to convert audio files to mp2. This is a command line exectuted program. Here is the command line that I use to execute the external program with the input and output audio files at the root level: cmd.exe /k ""C:New Folderffmpeg.exe" -i "C:Test.mp3" -y "C:Test.mp2"" This command line works correctly whether I am using Shell() or System.Diagnostics.Process (Process) to execute the external program. I am going the Process route so I can know when the conversion has finished.Now, I really don't want to use the root directory for this but when I go below root with this line using Process the external program will not execute:[code]Can anyone tell me why that line will not work with Process though it works as expected with Shell()? I can't figure out how to stop the external program to get some feedback as to what its problem is.

View 7 Replies View Related

Using Psexec.exe From PsTools To Send A Command To A Remote System To Fire A Command

Mar 17, 2010

I am currently using psexec.exe from PsTools to send a command to a remote system to fire a command through a command prompt however I am finding that the shell I am doing does not seem to like the spaces in the path.


View 3 Replies View Related

ExecuteReader Requires Command To Have Transaction When Connection Assigned To Command Is In Pending Local Trans?

Nov 8, 2007

Any ideas on how I handle the following error thrown in the SqlDataAdapter.Fill as a result of the BeginTrans in the callee?

System.InvalidOperationException = {"ExecuteReader requires the command to have a transaction when the connection assigned to the command is in a pending local transaction.The Transaction property of the command has not been initialized."}


View 7 Replies View Related

IDE :: ExecuteReader Requires Command To Have Transaction When Connection Assigned To Command Is In Pending Local Trans?

Jun 30, 2010

Public Sub ExecuteTransaction(ByVal connectionString As String) Using connection As New OleDbConnection(connectionString)

Dim command
As New OleDbCommand()
Dim transaction
As OleDbTransaction


View 1 Replies View Related

Sql Command Inside For Loop?

Jul 28, 2009

i trying to insert into database everytime a loop complete. but there is a syntax error saying "Incorrect syntax near '1'" at myCommand.ExecuteNonQuery(). here is my code and i really don't where went wrong. expert,


View 7 Replies View Related

Run A Command Line EXE From .NET?

Mar 3, 2006

I want to run the following command line program from VB.NET: rotor95.exe -d -k "password" -i "C:FileLocation" -o "C:FileLocation" The reason for this is that I don't want my users to have to drop out to a command line prompt in order to run a tiny program for 3 seconds.  Typing in a 50 - 75 character file path twice isn't any fun either.

I tried using tooltask as discussed in the MSDN2 help but it appears to work with switches (/d etc.) but not parameters (-k "password").  I couldn't get the thing to work.  See the following for the tooltask example:[URL]..light now I'm just using Shell("rotor95.exe -d -k "password" -i "C:FileLocation" -o "C:FileLocation") which works just fine but I'd like to use the .NET 2.0 super-whammy version of handling this problem if there is a better way to do it.

View 3 Replies View Related

Using FTP Over The Command Line?

Sep 19, 2010

how to use basic FTP functions straight from the command line tool. and I started using Visual Studio to create "macros" for the command line tool (i.e. writing down specific functions to perform, write them to a txt file and then run Shell() to execute.)But what I want to know is if I can open a command prompt window and then interact with it. Say for example I'm writing an FTP class/object, I'd want to be able to keep a window up for my program to send commands to (And wishfully read data back from it.)Because it seems to me that whenever I use the Shell() command it just opens a prompt window and then closes it after my line of code has been executed. Is there way to interact with a command line window from Visual Studio? And maybe even scrape data from the terminal like with terminal emulator scripts?

View 1 Replies View Related

Add New Sql Command To DataSet's Command Collection And Fill DataTable?

Jan 16, 2010

I want to add a new select command to my dataset. To do that, I have added a new partial class to my project. Because we have to use partial class if we want to extend generated dataset codes. [code]...

View 3 Replies View Related

Insert Command Not Functional After Clear Command In Vb Report

Aug 21, 2011

User need to select their prefferable data to show in report. What i did is i have a clear command first to delete the temporary table. The temporary table is basically a table to stored user selection parameter data. After the clear command, i have
a insert command to insert user selection data into the temporary table. What happened now is when i run the program exe, first run of the report is work fined, but not the second and the following times of execution. It will return null or blank report. The weird thing is when i execute it from development environment, it seem like the report is able to pick up user selection parameter and run the report for the first times and the subsequent execution.

View 3 Replies View Related

Preset A Command And Have The Command Called On Different Option Clicks?

May 18, 2009

i have seen this in many codes, just not sure where to start and how to call the command. what i'm talking about is having code as such (this is for save file dialog):


View 3 Replies View Related

.net - How To Use Command Line Arguments

Aug 22, 2011

I have a console application which reads .txt files. I want to be able to drag a txt file over my app and it would automatically open my app and show the text files contents. I think I have to use command line arguments like this:

Sub Main(ByVal cmdArgs() As String)
End Sub
Sub ReadFile(FilePath as String)
End Sub

But how can I pass the text files path to my ReadFile sub?

View 1 Replies View Related

Allow Application To Be Run From A Command Line?

Jul 8, 2010

OK! I've written my application in all it's GUI glory. I now just want to be able to run it from dos/a command line/batch, with no GUI appearing? So it just runs (& does its batch process).

How can I detect if my application has been initiated from command line/dos?

How do I then not open up the application and show its GUI etc?

View 35 Replies View Related

Command Line Variables?

Dec 9, 2010

Printing Work Orders from with in a .NET scripted screenSummary of code:

Public Overrides Sub onload(ByVal e As ScriptonloadEventArgs)
Dim CWONO As String
SetValue("CWONO") = "WO_Number" '(This field is automatically created with previous code)


View 3 Replies View Related

Compile In Command-line?

Mar 9, 2009

I was wondering if it's possible to create a .vb source file from notepad and be able to build/compile from the command line without the need of a vb environment?

View 1 Replies View Related

Get Another Application Command Line?

Jun 7, 2011

is there anyway to get the another application environmenat commandline argument

View 1 Replies View Related

Get Forms App To Run Like Command Line App?

May 3, 2011

I have a forms app that contains a few forms. My task is to make it run invisibly when called from the command line with arguments.I have defined a Sub Main in a module and made it the startup item. I have an if/then/else that looks at args.length and if it equals 0 then I load the form and run the app normally. But how do I handle things when args are passed? I still need access to all the functions defined in my main form. Can I load the form invisibly and still "use" it?

View 14 Replies View Related

Getting Command Line Arguments ?

Feb 8, 2010

When you open up a .txt file, the command line opens up notepad.exe with the argument %1. which opens the text file. i dont know about the function but i understand a little bit about it.

So what i wanted to do was create a .lxproj, and make it open up with my application. i have done this part so far with an installer that creates registry keys. but, what i would like to know is how to open the file. for a test i would like a message box to be displayed if the program is run by clicking the .lxproj. if its opened normally the messagebox doesnt display.

View 5 Replies View Related

How To Execute A Command Line

Aug 2, 2011

I am making a console application that will be prompted from a cmd. I want to be able inside my application to start an other program. Here is the line I am trying to use: %SystemRoot%Microsoft.NETFrameworkv4.0.30319MSbuild.exe /p:Configuration=Release test.shfproj This is making Sandcastle Help File Builder create a documentation with the test.shfproj i've builded previewsly.


View 2 Replies View Related

How To Use Command Line Parameter

Aug 25, 2009

I want to create a shortcut that do following:Link back to "my application"with command line parameter so that it will not do anything.

View 4 Replies View Related

Read From Command Line?

Oct 3, 2009

I'm making a program that has to execute commands in cmd.exe, but without actually opening it. I set RedirectStandardOutput to True, and I need a way to read the result of the command from the stream. Right now, I use ReadToEnd(), but there's no end to the stream, apparently. How do I read the result of the command?[code]...

View 2 Replies View Related

Run SAP Transaction From Command Line App?

May 28, 2009

However, I've just inherited a problem and was wondering if anyone knows if I can solve it with a command line application written in .NET. Basically, we have a SAP transaction which has been written which imports data from a csv file.At the moment, it will be a manual process requiring someone to log in and run the transaction. Does anyone know if it's possible to action this from a command line app which we could then set up as a scheduled task?

View 1 Replies View Related

Copyrights 2005-15, All rights reserved