Hi everyone:
I have a simple script that perfectly works on a computer. The script is written in VBScript and ran using UFT (Unified Functional Testing).
Code:
Option Explicit
Dim objFSO, objFolder, strDirectory
strDirectory = "My_Path"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.CreateFolder(strDirectory)
However, when I try to run this code on another computer it didn't work. I changed the path to another path which corresponds to the new computer. The surprise comes when I try to run the code without using the variable strDirectory:
Code:
Option Explicit
Dim objFSO, objFolder, strDirectory
strDirectory = "Path"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.CreateFolder("My_Path")
which works fine in the new computer.
Does anyone know why is this happening? How can a script work in a computer but not in another computer? And moreover, how can the script work in this new computer when not using the strDirectory variable to store the path?