3 Replies - 926 Views - Last Post: 26 October 2010 - 02:35 PM Rate Topic: -----

#1 ebolisa  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 150
  • Joined: 22-September 09

Process.Start Q:

Posted 26 October 2010 - 01:57 PM

Hi,
“shutdown -s –t 60” shuts down the PC in 1 minute. I would like to make the seconds part of the syntax variable as:
Dim varSec as integer
Process.start(“shutdown –s –t” & varSec)


But it doesn’t work nor produces errors. Can it be done this way?
TIA
Is This A Good Question/Topic? 0
  • +

Replies To: Process.Start Q:

#2 Jack Eagles1  Icon User is offline

  • Pugnacious Penguin (inspired by no2pencil)
  • member icon

Reputation: 183
  • View blog
  • Posts: 1,152
  • Joined: 10-December 08

Re: Process.Start Q:

Posted 26 October 2010 - 02:24 PM

Try putting a space after t

Like this:
Dim varSec as integer
Process.start(“shutdown –s –t ” & varSec)



It doesn't throw an error because there's nothing wrong with Process.Start. It's the formatting of the external function which is wrong, so it's not part of VB.

This post has been edited by Jack Eagles1: 26 October 2010 - 02:25 PM

Was This Post Helpful? 1
  • +
  • -

#3 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1605
  • View blog
  • Posts: 5,162
  • Joined: 25-September 09

Re: Process.Start Q:

Posted 26 October 2010 - 02:34 PM

Try this:
    Dim varSec As Integer = 10
        Dim p As New Process
        p.StartInfo.FileName = "Shutdown.exe"
        p.StartInfo.Arguments = "-r -t " & varSec
        p.Start()

Was This Post Helpful? 0
  • +
  • -

#4 ebolisa  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 150
  • Joined: 22-September 09

Re: Process.Start Q:

Posted 26 October 2010 - 02:35 PM

Thank you. What a differance a space makes!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1