#1
|
|||
|
|||
Odd error trying to get a directory.
Hi.
I am having a strange issue. When I use the following extremely basic code snippet, the return sometimes works properly, and other times I get a completely different outcome. ... platformType is passed to the function Code:
Dim p, ppfile, ppfso, ppcmd, ppShell, ppPath ' Create the full path to the command file Set ppShell = CreateObject("Wscript.Shell") ppPath = ppShell.CurrentDirectory ppfile = ppPath & "\" & platformType & ".pp" ' Message box for Debugging Only msgbox ppfile 'Open the command file Set ppfso = CreateObject("Scripting.FileSystemObject") Set p = ppfso.OpenTextFile(ppfile, ForReading) ... c:\users\donnie\scripts and then construct the full filename which is supposed to be something like "c:\users\donnie\scripts\9k.pp" Sometimes it works properly, and most other times I get "c:\windows\system32\9k.pp" as the returned path instead, which of course leads to a File not Found. Thanks, Donnie Last edited by cboyack; 04-15-2021 at 02:40 PM. Reason: Please use [CODE] and [/CODE] tags to denote areas of code |
Thread Tools | |
Display Modes | Rate This Thread |
|
|