Groups | Blog | Home
all groups > vb.net > september 2007 >

vb.net : Questions about ProcessStartInfo


Family Tree Mike
9/30/2007 7:34:02 PM
1. I don't think there is any other command for cmd.exe...
2. @ is a batch symbol which only applies to batch files, or interactive
cmd.exe. Your process is running cmd.exe with commands (I suspect), and not
running a batch where @ applies.


[quoted text, click to view]
Academia
9/30/2007 8:36:15 PM
I use:

'Execute Command (DOS) commands

Dim StartInfo As New ProcessStartInfo

Static sMyProcess As New Process

StartInfo.FileName = "cmd"

....



1) Is there another file that runs DOS commands in XP besides cmd?

Does the XP Command prompt window use cmd or something else?



2)The @ doesn't appear to work for me. I use:

SWIn.WriteLine("@echo off")

but the command shows in the output. I believe the @ should suppress the
listing of the command in the output.



Thanks for any help





rowe_newsgroups
10/1/2007 3:28:32 AM
[quoted text, click to view]

If this is the case you could first create the batch file with the
necessary commands and then use the Process class to execute the batch
file. Just be sure to make sure your application has adequate
permission to do so on the client machine.

Thanks,

Seth Rowe

Family Tree Mike
10/1/2007 7:53:03 AM
I believe you would need to change the environment variable for the PROMPT,
then use that environment for the process.start. I don't think a command
argument for cmd.exe exists for this.

[quoted text, click to view]
rowe_newsgroups
10/1/2007 8:52:36 AM
[quoted text, click to view]

How about this:

///////////////////////
'// Thanks to Wikipedia for giving me this
'// simple batch file

Dim filePath As String = "C:\MyFile.bat"

Using sw As New StreamWriter(filePath, False)
sw.WriteLine("@echo off")
sw.WriteLine("echo Hello, World!")
sw.WriteLine("pause > nul")
End Using

Dim p As Process = Process.Start(filePath)

p.WaitForExit(2500)

File.Delete(filePath)
//////////////////////

Thanks,

Seth Rowe
Academia
10/1/2007 9:41:43 AM
"Family Tree Mike" <FamilyTreeMike@discussions.microsoft.com> wrote in
message news:83A1D868-B773-4BB8-A6B8-4D5F553257A0@microsoft.com...

[quoted text, click to view]

All I want to do is change the prompt without echo.
Is there some way (without using a batch file) that I could effectively
do.
sMyProcess.StartInfo = StartInfo

sMyProcess.Start()

Dim SWIn As System.IO.StreamWriter = sMyProcess.StandardInput

SWIn.WriteLine("@prompt $G")

....

Maybe an argument??

Thanks



Academia
10/1/2007 9:42:25 AM

All I want to do is change the prompt without echo.
Is there some way (without using a batch file) that I could effectively
do.
sMyProcess.StartInfo = StartInfo

sMyProcess.Start()

Dim SWIn As System.IO.StreamWriter = sMyProcess.StandardInput

SWIn.WriteLine("@prompt $G")

....

Maybe an argument??

Thanks


[quoted text, click to view]

Academia
10/1/2007 4:31:53 PM
thanks for the help

"Family Tree Mike" <FamilyTreeMike@discussions.microsoft.com> wrote in
message news:04057CC5-6606-447F-81C1-0DA9813FD1E2@microsoft.com...
[quoted text, click to view]

Academia
10/1/2007 4:32:43 PM
Thanks, I'll try that
[quoted text, click to view]

AddThis Social Bookmark Button