• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1158
  • Last Modified:

Vbscript : Can FSO.GetBaseName return a foldername ?

I would like to use the foldername of a folder of which the contextmenu is clicked to be used as a variable in the script that is called by clicking on the item in the contextmenu.  Can this be done with FSO.GetBaseName ?
0
itbabe
Asked:
itbabe
  • 4
  • 3
1 Solution
 
sirbountyCommented:
You won't get the complete path in that manner...

I'm not sure I understand exactly what you're trying to accomplish.
Could you, perhaps, post a code snippet (I'm a visual-guy ;)
0
 
itbabeAuthor Commented:
I just wanted the foldername returned when an item was clicked in the contextmenu.

I did it the following way,  it works

Dim arg, fso, shell, Oldfoldername
Set fso = CreateObject("Scripting.FileSystemObject")
Set shell = CreateObject("WScript.Shell")
arg = WScript.Arguments(0)
Oldfoldername=fso.GetBaseName(arg)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
itbabeAuthor Commented:
0
 
sirbountyCommented:
Can you post the solution?
0
 
itbabeAuthor Commented:
The following has bee, used.
Dim arg, fso, shell, Oldfoldername
Set fso = CreateObject("Scripting.FileSystemObject")
Set shell = CreateObject("WScript.Shell")
arg = WScript.Arguments(0)
Oldfoldername=fso.GetBaseName(arg)

I created a reference in HKEY_CLASSES_ROOT\Folder\shell to start up the script with %1 to be able to send the arguments to the vbs.
0
 
sirbountyCommented:
Guess I still don't understand what you're after with this - but to the closing moderator - I have no problems with the closure, and since I'm the only other one involved - no reason for the 4-day wait... :^)
Glad you got it working..
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now