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 vb.net.I never learn VB.I have worked on C#.net.when 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.

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


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
Posted
Updated 1-Dec-15 23:17pm
v2
Comments
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    

VB
Dim command = "notepad" 'your command to run e.x "notepad"
Shell(command)
 
Share this answer
 
VB.NET
Module Module1

    Sub Main()

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

        Console.ReadKey()


    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
        p.Start()
    End Sub


End Module


as described here http://stackoverflow.com/questions/10261521/how-to-run-dos-cmd-command-prompt-commands-from-vb-net[^]
 
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