1

I have develop application that start at Windows start up. when I launch application by double clicking, it works fine. When run on windows start up, the application launch well but it cannot access any other files placed on application directory. I got that error 'The system cannot find the file specified'

my code:

Process.Start("file_name")

I used this registry key to start up:

HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"

.Net 3.0, Windows 7

What could be the problem ? and please suggest a solution.

thank you.

Jum Remdesk
  • 91
  • 1
  • 2
  • 10
  • 3
    Check the working directory, both when you run it yourself and when it's run at startup. Compare the two. My guess is that they are different, hence the program not being able to find the file by relative path. – MicroVirus Aug 21 '14 at 18:55
  • 1
    http://stackoverflow.com/questions/2822951/use-registry-to-startup-a-program-and-also-change-the-current-working-directory – Vland Aug 21 '14 at 20:10
  • @MicroVirus It's the problem. thank you for the suggestion. – Jum Remdesk Aug 21 '14 at 20:54

1 Answers1

0

After Replace,

Process.Start("file_name")

with

Process.Start(My.Application.Info.DirectoryPath & "\file_name")

Works fine.

Jum Remdesk
  • 91
  • 1
  • 2
  • 10