Giac_Torrence Posted December 15, 2016 Share Posted December 15, 2016 Hi all! I'm having trouble finding a way to create a batch file that will create pre-named folders within a folder that is dragged and dropped onto that batch file. So my batch file currently looks like: md New1 md "New 2" md "New 3"\"New 4" and I'm wondering if there is some way to create those folders in a folder that I can drag and drop onto the file. Thanks! Link to comment Share on other sites More sharing options...
jaclaz Posted December 15, 2016 Share Posted December 15, 2016 The action of drag n' drop something over a .cmd file (batch file) is passed as first parameter to the batch, which is "%1". So, create a batch file as follows: @ECHO OFF SETLOCAL ENABLEEXTENSIONS ECHO %1 ECHO %~1 ECHO %~d1 ECHO %~dp1 ECHO %~dpn1 ECHO %~dpnx1 ECHO %~z1 PAUSE to have an idea of what you can get by dropping on the cmd file a directory. As the usual recommendation, using directory or filenames including spaces is not particularly smart because there is the need to put them into double quotes (and remove quotes when needed), BTW out of the three lines you posted one is wrong. jaclaz Link to comment Share on other sites More sharing options...
gunsmokingman Posted December 16, 2016 Share Posted December 16, 2016 VBS Drag And Drop Function '-> Checks To Make Sure Only 1 Files Is Process If WScript.Arguments.Count = 0 Then MsgBox "You Must Drag And Drop One File Onto This Script.",4128, _ "Error No Drag And Drop performed" ElseIf WScript.Arguments.Count = 1 Then MsgBox WScript.Arguments.Item(0),4128, "Drag Drop Demo" ElseIf WScript.Arguments.Count > 1 Then MsgBox "Drag And Drop To Many Files, This Script Is Only For One File To Be Drag And Drop Onto " & _ "This Script",4128,"Error To Many Files" End If Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now