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


ADVERTISEMENT

Open Excel With Command-line Switches?

Sep 10, 2009

how to open excel with switches using vb.net, similar to what "Run.." does in Windows.. eg: this is what you would put in the "Run" ComboBox : excel.exe /r "C:ook.xls"

View 1 Replies

PathName In Shell Function With Arguments And Command Line Switches

Jul 10, 2009

I'm using VB2008 Shell function to execute file with arguments. But I'm not sure how should look my PathName in Shell function with all necessary arguments and command-line switches. Without arguments: [Code]

View 4 Replies

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 _

[Code].....

View 6 Replies

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
Me.Close()

[code]....

View 14 Replies

Open A Command Window As Another User?

Jan 28, 2010

I am trying to open a cmd window as an admin but it never works. I can open a command window but it does not open as the admin.. Here is my code (VB.NET 2008)..

'This is in a module Public strUserName, strPassword, strDomain As String Public SecPassword As New Security.SecureString() Public impersonater As New ProcessStartInfo()

[Code]...

View 4 Replies

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"

[Code].....

View 8 Replies

VS 2008 Sending Arguments To Command Line Window?

Apr 13, 2010

I've done it before, so I'm getting a little frustrated on how to get this to work exactly I need to send some arguments to a command line window and I thought I did it this way:

VB.NET
Dim p As New Process
p.StartInfo.FileName = "cmd"

[code].....

View 11 Replies

Open A Command Window As Another User Rate

Jun 22, 2010

I am trying to open a cmd window as an admin but it never works. I can open a command window but it does not open as the admin.. Here is my code (VB.NET 2008)..

[Code]...

View 5 Replies

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.

[Code]...

View 6 Replies

Open A Console / Command Window When Using VS 2008 Express

Jul 30, 2009

I have both the VB and C# versions of Visual Studio 2008 Express. When I run a console application in either version, instead of the console opening in an old DOS style command window like it does in VS 2005, it actually blacks out both monitors attached to my computer and treats the entire screen real estate as the console.Anyone know how to get the app to run in a small command-type window when I run it? It's like the console is running Full Screen. If I set a break point, switch from the IDE t the console and then hit Alt+Enter it switches to the small window that I want, but I still can't figure out how to make the app start with the console that way.I could post a screenshot but it would look like a big black square...no window, no frame, just the inky blackness of frustration.

View 2 Replies

Give The Form A Command When User Switches To Another Application?

Apr 20, 2009

let's say i have this application running, preset size. and there are other applications, like, firefox, vb, etc. in the background where i can click on them to bring them to front and use. now, when that's done, i'd like my application to minimize by it's self instead of just becoming a application that got sent to the back of another one.. the minimize is just to get me started, since i'll probably resize it to a button or so.just a squirrel looking for my nut...

View 4 Replies

When Use The "anything.show" Command, It Will Always Open In A New Window - Make It Open In The Same Window?

Jun 12, 2009

when i use the "anything.show" command, it will always open in a new window... How can i make it open in the same window?

View 11 Replies

.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

How To Open Multiple Files Using "open With" Command Line Arguments

May 15, 2012

I have an application that can read certain types of files, and I have it working so that if you do "open with" from windows, it automatically starts the application and opens the selected file.

Unfortnately, I cannot get it to work for more than one file.

System.Environment.GetCommandLineArgs() contrains the following:
System.Environment.GetCommandLineArgs(0) = name and path to the .exe
System.Environment.GetCommandLineArgs(1) = name and path to the first file selected to be opened

System.Environment.GetCommandLineArgs().Length is 2 when the user tries to open 1 file, which makes sense since the first argument is the .exe itself and the 2nd is the path to the file, but it does not increase to 3 if the user tries to open 2 files... meaning that System.Environment.GetCommandLineArgs(2) is never populated Here is some sample code that shows the problem: It will recognize no files or 1 file being opened, but if you try to open multiple it will only show the first.

[Code]...

View 1 Replies

Open Command Prompt And Run The Command "netstat -a"

Oct 2, 2011

I'm starting to make a program that will run some commands, so i need some code that will open command prompt and run the command "netstat -a".

View 11 Replies

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.

[Code]...

View 3 Replies

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."}

[code].....

View 7 Replies

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

[Code]...

View 1 Replies

Read From Command / DOS Window

Jul 30, 2009

I'm looking to read from a command prompt window so I can redirect the output to my project. I've looked all over the net and the only codes that I've seen don't work in VB 2008.

View 1 Replies

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

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

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

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

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):

[Code]...

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

VB Express 2008 Command Window?

Sep 27, 2009

In debug mode is the command window option available in visual Basic express 2008?

View 1 Replies

VS 2008 Execute A Command In The Cmd Window?

Jun 16, 2009

I need to convert a .tex file to a .dvi file (latex file), which I can do simply using a command in the cmd window: "latex C: est.tex" for example, would create the "test.dvi" file from the "test.tex" file.

I know how to start the cmd window (Process.Start("cmd.exe")), yet how to get VB to actually 'type' a message and execute it...

View 11 Replies

What Command Will Actually Close The Console Window

Sep 25, 2003

I'm writing a console Application in VB.NET. I give user a list of menus to choose from and the last one is Enter 'Q' to quit. what command will actually close the console window.

View 14 Replies

.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







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