2 Replies - 678 Views - Last Post: 29 November 2010 - 05:51 AM Rate Topic: -----

#1 Poppa Mintin  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 72
  • Joined: 13-September 08

Odd problem with Shell

Posted 28 November 2010 - 11:57 AM

Hi, I don’t understand why a program which has been working well for a couple of years, has suddenly stopped working...
in debug mode the program works fine up to an instruction which used to read: -

Shell "C:\Xxx\Yyy\Prog.exe"


At this point it stops with an exception, saying 'Can't find C:\Xxx\Yyy\Prog.exe' or words to that effect.
As I say, it's worked well for a few years... But I thought I'd try to see where the problem is..
First I checked that C:\Xxx\Yyy\Prog.exe does exist and in that location, which of course it does.
Then I figured I'd force it to check it's there...
For ease of reading the code while it's running, at the start of a subroutine I dimensioned a string variable and initialised it...

Dim z as String = "C:\Xxx\Yyy\Prog.exe"


Then when I needed to shell (run) the second program I added: -

If My.Computer.FileSystem.FileExists(z) Then
            Shell(z)
        End If 


The code runs up to the 'Shell' which I take to prove that the file has been found, but then I get the same 'Can't find file' exception...
I tried taking out the String and writing it in full (twice) but made no difference...

What's going on?
I'd appreciate some help with this.

Win7 pro
Tons of RAM
Intel quad processor

Poppa.

This post has been edited by Poppa Mintin: 28 November 2010 - 12:00 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Odd problem with Shell

#2 _HAWK_  Icon User is online

  • Master(Of Foo)
  • member icon

Reputation: 1030
  • View blog
  • Posts: 4,009
  • Joined: 02-July 08

Re: Odd problem with Shell

Posted 28 November 2010 - 12:11 PM

The Process Class replaces shell in .Net:
Process.Start("C:\Xxx\Yyy\Prog.exe")

This post has been edited by hawkvalley1: 28 November 2010 - 12:11 PM

Was This Post Helpful? 0
  • +
  • -

#3 Poppa Mintin  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 72
  • Joined: 13-September 08

Re: Odd problem with Shell

Posted 29 November 2010 - 05:51 AM

Thanks Hawkvalley

That worked first time, as you knew it would !

Poppa.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1