When writing a batch script, you can determine the parent folder of a file parameter by parsing the parameter. If %1 is a fully qualified file name, then set GetTheParent=%~DP1 would define the parent folder.

Using Vbscript, you could:

Dim fso, oArgs
Set oArgs = WScript.Arguments
FQFN = oArgs(0)
Set fso = CreateObject("Scripting.FileSystemObject")
GetTheParent = fso.GetParentFolderName(FQFN)
Wscript.Echo GetTheParent