New Member.

VB Script Code Not Running

Hi Team,

I am unable to execute below line of code which was running perfectly before

Set gobjFso = CreateObject("Scripting.FileSystemObject")
gstrRelativePath = gobjFso.GetParentFolderName(WScript.ScriptFullName)

showing error as Object required for WScript.ScriptFullName




1 Reply
Honored Contributor.
Honored Contributor.

Re: VB Script Code Not Running

gobjFso.GetParentFolderName(WScript.ScriptFullName) --- current code

gobjFso.GetParentFolderName(FullPath) ---- should be code

if you want to get the fullpath using wscript, you should create that  wscript object and then get the path. You have used wscript as is and thus it is throwing the error. 

set wshShell = CreateObject("WScript.Shell").. and then get the path using the object and pass that value for fullpath. 

GoScriptLESS, Create test in seconds using UFT, View Demo and more info at scriptlessautomation.com

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.