Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
March 20, 2006
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, oArgsSet oArgs = WScript.ArgumentsFQFN = oArgs(0)Set fso = CreateObject("Scripting.FileSystemObject")GetTheParent = fso.GetParentFolderName(FQFN)Wscript.Echo GetTheParent
You May Also Like