Questions about ProcessStartInfo

A

Academia

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
 
G

Guest

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.
 
R

rowe_newsgroups

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.

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
 
A

Academia

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.

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
 
A

Academia

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
 
G

Guest

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.
 
R

rowe_newsgroups

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

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
 
A

Academia

thanks for the help

Family Tree Mike said:
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.
 
A

Academia

Thanks, I'll try that
rowe_newsgroups said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top