Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript to prompt a folder name

Status
Not open for further replies.

chadbi

IS-IT--Management
Nov 24, 2008
14
US
Hello,

Does anyone have a VBScript that will go to a directory and prompt to rename a folder that already exists?

Example:

I have a folder named "Test1". After I do a file move and deletion, I want to get a prompt that identifies the "Test1" folder and asks for the folder to be renamed.

Thanks in advance for any suggestions.


 
Try something like this:

Set objFSO = CreateObject("Scripting.FileSystemObject")
foldername="C:\FolderA"

If objFSO.FolderExists(foldername) Then
set objFolder = objFSO.GetFolder(foldername)

strNewName = InputBox("Enter the new folder name for: " & objFolder.name)
objFolder.name= strNewName

End If
 
Worked great! Thanks for the help! [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top