OT - Batch Files
OT - Batch Files
(OP)
Good Morning
I know this is a little off topic but you guys are so smart I figured you could help me out.
I would like to create a batch file that will help me create folders. Basically every time I get a job I create a whole bunch of folders for that job.
ex. Job 100
NC Programs
Iges Files
Trodes
MC9 Files
I would like to be able to create a batch file that helps me do this faster. I would like it to prompt me for the job number then create all of the folders for me.
Any help would be greatly appreciated.
Thanks
Chris
I know this is a little off topic but you guys are so smart I figured you could help me out.
I would like to create a batch file that will help me create folders. Basically every time I get a job I create a whole bunch of folders for that job.
ex. Job 100
NC Programs
Iges Files
Trodes
MC9 Files
I would like to be able to create a batch file that helps me do this faster. I would like it to prompt me for the job number then create all of the folders for me.
Any help would be greatly appreciated.
Thanks
Chris






RE: OT - Batch Files
Making the best use of this Forum. FAQ559-716
How to get answers to your SW questions. FAQ559-1091
Helpful SW websites every user should be aware of. FAQ559-520
RE: OT - Batch Files
You might be able to do it through a batch file but I'm not sure you can make it prompt you for input and then pass that variable to the rest of the code.
Jason Capriotti
Smith & Nephew, Inc.
RE: OT - Batch Files
makedirs.bat
mkdir “Job %1”
mkdir “Job %1\NC Programs”
mkdir “Job %1\Iges Files”
mkdir “Job %1\Trodes”
mkdir “Job %1\MC9 Files”
Then with the makedirs.bat in the dir you want the Job xxx folder you would type:
makedirs 100
to create the directory and its subs. Basically the batch file replaces %1 with the first thing that you type after the name of the batch file.
RE: OT - Batch Files
Send it my way.
Thanks
Chris
RE: OT - Batch Files
I cannot get this to work for me. It seems to be stuck in a loop. It just keeps cycling. It never creates the folders.
Please help.
Thanks
Chris
RE: OT - Batch Files
Just create the (empty) folder structure you want
using Windows Explorer, & save that on your Desktop (or wherever you want) to be used as a "template". Then whenever you want to start a new job, simply copy, paste & rename the Job XXX folder to the destination folder.
Making the best use of this Forum. FAQ559-716
How to get answers to your SW questions. FAQ559-1091
Helpful SW websites every user should be aware of. FAQ559-520
RE: OT - Batch Files
Chris
RE: OT - Batch Files
Also, can you explain what you mean by "a couple of spots that I need to create folder structures at for the same job."
Making the best use of this Forum. FAQ559-716
How to get answers to your SW questions. FAQ559-1091
Helpful SW websites every user should be aware of. FAQ559-520
RE: OT - Batch Files
Basically I have a folder where I store my mold designs and a seperate folder where I store all of my CNC programs.
Chris
RE: OT - Batch Files
I can see a couple of problems that could have occurred if you copied and pasted from my post into a batch file.
1) The makedirs.bat line should not be in the actual batch file. It is just the name that I made up for it. This could be the cause of the looping.
2) Somewhere along the line, the post got the fancy paired quote marks. I think it’s the result of creating the post in Word. In any case they need to be made into regular quote marks.
I’m going to try linking the batch file for you. Hopefully that will work.
http:/
Eric
RE: OT - Batch Files
When I run the bat file (with or without quotes) it creates the folders both inside & outside the Top Level folder. Any idea why that would be happening?
Making the best use of this Forum. FAQ559-716
How to get answers to your SW questions. FAQ559-1091
Helpful SW websites every user should be aware of. FAQ559-520
RE: OT - Batch Files
CODE
mkdir Job_%1\NC_Programs
mkdir Job_%1\Iges_Files
mkdir Job_%1\Trodes
mkdir Job_%1\MC9_Files
I still think it is quicker & easier to rename then drag-n-drop ... 6 clicks using the bat file, 3 clicks using drag-n-drop ... but that's just my preference. Also I dislike having to use underscores.
Making the best use of this Forum. FAQ559-716
How to get answers to your SW questions. FAQ559-1091
Helpful SW websites every user should be aware of. FAQ559-520
RE: OT - Batch Files
----CUT HERE----
Dim fso, num, jobfolder
num = InputBox("Enter job number")
Set fso = CreateObject("Scripting.FileSystemObject")
jobfolder = "Job " + num
fso.CreateFolder(jobfolder)
fso.CreateFolder(jobfolder + "\NC Programs")
fso.CreateFolder(jobfolder + "\Iges Files")
fso.CreateFolder(jobfolder + "\Trodes")
fso.CreateFolder(jobfolder + "\MC9 Files")
-----CUT HERE----
Just double-click that puppy and it'll prompt you for a number and make the folders in the current directory. You could even make shortcuts to it with different "Start in" directories for the different places you want your folders.
Jonathan Anderson
RE: OT - Batch Files
That is exactly what I was looking for.
Thanks
Chris
RE: OT - Batch Files
What do you mean by Start In? And How would I do this?
Chris
RE: OT - Batch Files
Do you know any good resources for learning this stuff?
Chris
RE: OT - Batch Files
As far as resources go, msdn.microsoft.com is a good place for all things Microsoft. You can also search for something like "VBScript" or "windows script host". Specifically on MSDN, the main documentation page for the scripting is http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/scriptinga.asp
Jonathan Anderson
RE: OT - Batch Files
The quotes allow for the use of spaces in the directory names.
Eric
RE: OT - Batch Files
The VB Script from JonathanAnderson also works well & needs less clicks. I still prefer my method, but it's really a moot point as I don't use any of them anyway.
It's good to learn something new though. Thanks guys.
Making the best use of this Forum. FAQ559-716
How to get answers to your SW questions. FAQ559-1091
Helpful SW websites every user should be aware of. FAQ559-520