Hello,
I am new here and not a scripting expert. I am trying to make a script that will ask a user for their name and then open their home directory on the server. I have mapped the root of the home directories to Z:\ . The problem I have is that I keep getting an error message after putting in the name that says "The system cannot find the file specified." Code: 80070002 Source: (null)
I got the script from and modified it because it seemed close to what I am trying to do, except that I don't need to open a file within the folder. Can anyone see what I did wrong. Thanks.
CONST strDir = "Z:\"
set objShell = CreateObject("WScript.Shell")
set objFSO = CreateObject("Scripting.FileSystemObject")
function findFolder(strDir, strFlag)
set objFolder = objFSO.GetFolder(strDir)
for each objSubFolder in objFolder.SubFolders
if (inStr(objSubFolder.Name, strFlag)) then
findFolder = objSubFolder.Path
exit function
else
findFolder = findFolder (objSubFolder.Path, strFlag)
end if
next
end function
strFlag = inputBox("Enter your name:")
strWeb = findFolder(strDir, strFlag)
objShell.Run strWeb
I am new here and not a scripting expert. I am trying to make a script that will ask a user for their name and then open their home directory on the server. I have mapped the root of the home directories to Z:\ . The problem I have is that I keep getting an error message after putting in the name that says "The system cannot find the file specified." Code: 80070002 Source: (null)
I got the script from and modified it because it seemed close to what I am trying to do, except that I don't need to open a file within the folder. Can anyone see what I did wrong. Thanks.
CONST strDir = "Z:\"
set objShell = CreateObject("WScript.Shell")
set objFSO = CreateObject("Scripting.FileSystemObject")
function findFolder(strDir, strFlag)
set objFolder = objFSO.GetFolder(strDir)
for each objSubFolder in objFolder.SubFolders
if (inStr(objSubFolder.Name, strFlag)) then
findFolder = objSubFolder.Path
exit function
else
findFolder = findFolder (objSubFolder.Path, strFlag)
end if
next
end function
strFlag = inputBox("Enter your name:")
strWeb = findFolder(strDir, strFlag)
objShell.Run strWeb