|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Create New Folder with VBS
Hi there,
I want to write a simple script that creates a New Folder (from the Desktop or another folder or Explorer). I'm new to this stuff and struggling with it quite a while now I'm almost sure it can't be that complicated.This is what I came up with (it ain't work): Code:
Dim Wsh
Set Wsh = Wscript.CreateObject("Wscript.Shell")
Wsh.SendKeys "+{F10}{N}{ENTER}"
Can anyone help? Thanx! XScale |
|
#2
|
|||
|
|||
|
use fileobject in the vb script run time. u can do it.
|
|
#3
|
|||
|
|||
|
What exactly do you mean, cleverpig? Can you elaborate please?
Thanx! XScale |
|
#4
|
|||
|
|||
|
sub CreateFolder(NewDir as string)
dim objFSO Set objFSO = CreateObject("Scripting.FileSystemObject") objFSO.CreateFolder (NewDir) set objFSO=nothing endsub |
|
#5
|
|||
|
|||
|
Thanks. Well, this is obviously a subroutine and I don't get it running. What string ist NewDir? The name of the folder?
In general, how hard is it to implement such a script? I want it to act exactly like creating a folder from the context menu. I want to assign a key command to it (such as Ctrl + Alt + N), so that it creates a folder on the desktop OR in the currently active Explorer window. Basically just the thing that is common under Mac OS. Can it be done? XScale |
|
#6
|
|||
|
|||
|
NewDir is a variable holding a string that is the new directory path, like NewDir = "c:\myfolder\mynewfolder"
|
|
#7
|
|||
|
|||
|
OK, so I need to pass the path of the active Explorer window to the script... Hhhmmmm...
|
|
#8
|
|||
|
|||
|
U will get the path of the active Explorer window,and then pass it to the script which can built it(make dir)?!
|
|
#9
|
|||
|
|||
|
hi ...
i have this problem .. when i run the "CreateFolder " method ... it runs ok and gives me no error !!! ' but the new folder is NOT created !! i don't know why !!!! anyone know how to fix this problem ???? i'm using vb 6.0 pro , on win xp pro. edition... Thanks |
|
#10
|
|||
|
|||
|
To test your code:
sub CreateFolder(NewDir as string) Dim fso, f Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.CreateFolder(NewDir) Msgbox f.Path set f=nothing set fso=nothing end sub |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Create New Folder with VBS |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|