Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an application which build in never learn VB.I have worked on I run it's setup and execute it,I able to see command prompt.But when I using this application for scheduling task/creating task and scheduling, unable to see command prompt.

I am using following code that create process.

Dim Cw As New ProcessStartInfo(name, name & " " & name)
Cw.WindowStyle = ProcessWindowStyle.Maximized

Is there is any other way to do this?Without making a process can I execute shell program?I am working on windows8 opeating system
Updated 1-Dec-15 23:17pm
CPallini 2-Dec-15 5:18am    
What's wrong in using the Process class?
Kornfeld Eliyahu Peter 2-Dec-15 5:26am    
Let me try to understand...
If you run the application directly - you can see the command prompt,
but if you run it via scheduler you do not?
Member 11589429 2-Dec-15 5:50am    
yes Peter
Kornfeld Eliyahu Peter 2-Dec-15 5:56am    
Maybe when you run via the scheduler you are running under an identity has no privileges using the screen (like most services)?
Maciej Los 6-Dec-15 14:07pm    

Dim command = "notepad" 'your command to run e.x "notepad"
Share this answer
Module Module1

    Sub Main()

        RunCMDCom("dir", "/W", True)


    End Sub

    Public Sub RunCMDCom(command As String, arguments As String, permanent As Boolean)
        Dim p As Process = New Process()
        Dim pi As ProcessStartInfo = New ProcessStartInfo()
        pi.Arguments = " " + If(permanent = True, "/K", "/C") + " " + command + " " + arguments
        pi.FileName = "cmd.exe"
        p.StartInfo = pi
    End Sub

End Module

as described here[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900