1
I have a task that runs a .exe , It is a simple VB program that reads from a txt file, in the code I have this:
My.Computer.FileSystem.OpenTextFileReader("test.txt")
But when the scheduler runs the .exe , it throws a FileNotFound exception because it is searching in "C:\Windows\system32\test.txt".
I tried writing the path as ".\test.txt" I need the file to be in the same directory than the .exe.
How can I fix this? Is this a windows-7 task scheduler problem?
Note: when I run the program manually it doesn't throws the exception. update: the path must be like that because im going to deploy the .exe in other computers with other paths
1Replace test.txt with c:\full\path\of\file\test.txt – DavidPostill – 2014-10-31T16:02:01.807
I should have wrote this, I need the path like that because I'm going to put the .exe in other computers and the path will change. – Wabonano – 2014-10-31T16:03:58.997
"I need the path like that because I'm going to put the .exe in other computers and the path will change" If the path is going to change to something unknown, then how would you expect Windows to know where to find it? – Ƭᴇcʜιᴇ007 – 2014-10-31T16:12:35.247
the path of the .exe might change, thats why I want to write "test.txt" so I can put the .txt in the same level as the .exe – Wabonano – 2014-10-31T16:18:18.823
Um, just to verify: What exactly are we talking about here? Visual Basic 6? Visual Basic .NET? Or VBScript? I’ll correct my answer accordingly. – Daniel B – 2014-10-31T16:25:26.530