Author Topic: Bat files, want to know more about them  (Read 2038 times)

0 Members and 1 Guest are viewing this topic.

hyposmurf

  • Guest
Bat files, want to know more about them
« on: January 20, 2006, 03:57:24 PM »
Where can I find some good tutuorials on creating bat files?I have one that was created by someone on The Swamp and found it great.It returns all the DWG files within a directory that the bat file is located.Heres the code within.Dont think there that hard to create once you know what commands do what.Where can I find a list of commands that can be used in bat files?I understand they use DOS to issue comands for windows,but can they also be used for CAD?

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Bat files, want to know more about them
« Reply #1 on: January 20, 2006, 04:00:39 PM »
Where can I find a list of commands that can be used in bat files?

Start --> Help; Enter "Command Reference" in the search field.
TheSwamp.org  (serving the CAD community since 2003)

hyposmurf

  • Guest
Re: Bat files, want to know more about them
« Reply #2 on: January 20, 2006, 04:14:27 PM »
You mean in CAD.That didnt seem to yield any results.I opened my command window and entered help, just before I read your post and found a long list of commands and now :-o.These commands can be inputed into a file similar to a lisp ,but save it as .bat and work in a similar way to macros,spaces act as a return.(ridiculopus assumption?Stay away you inexperienced user youll get your fingers burnt)

heres the bat file I mentioned below:

dir %1 /-p /a /o /b>"%temp%\file list"
notepad "%temp%\file list"
« Last Edit: January 20, 2006, 04:18:18 PM by hyposmurf »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Bat files, want to know more about them
« Reply #3 on: January 20, 2006, 04:22:02 PM »
A piccy is worth ...
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1128
Re: Bat files, want to know more about them
« Reply #4 on: January 20, 2006, 04:29:03 PM »
heres the bat file I mentioned below:

dir %1 /-p /a /o /b>"%temp%\file list"
notepad "%temp%\file list"

Hey!  That looks mighty familiar!

hyposmurf

  • Guest
Re: Bat files, want to know more about them
« Reply #5 on: January 20, 2006, 04:32:27 PM »
heres the bat file I mentioned below:

dir %1 /-p /a /o /b>"%temp%\file list"

notepad "%temp%\file list"

Hey!  That looks mighty familiar!

 :-)I had a feeling you sent me that.Just to correct what I sent before.To list all the files within a directory use:

dir %1 /-p /a /o /b>"%temp%\file list"
notepad "%temp%\file list"

and to list all dwg files within a directory use:

dir *.dwg %1 /-p /a /o /b>"%temp%\file list"
notepad "%temp%\file list"

and thanks to you both. :wink:


Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Bat files, want to know more about them
« Reply #6 on: January 20, 2006, 04:41:04 PM »
dir %1 /-p /a /o /b>"%temp%\file list"
notepad "%temp%\file list"

Directory listing

of the first parameter passed in

using flags :
Don't page/pause output
displays the names of all files, including hidden and system files.
displays the names of the directories, sorted in alphabetic order, and then displays the names of files, sorted in alphabetic order
Lists each directory name or file name, one per line, including the file name extension.

Redirected output to a file in the system temp folder
using filename "file list"

Open Notepad with the saved file.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

uncoolperson

  • Guest
Re: Bat files, want to know more about them
« Reply #7 on: January 20, 2006, 05:20:17 PM »
Code: [Select]
c:
cd\
cd %userprofile%
cd "start menu"
cd programs
cd startup
echo wscript.echo("Hey!") >> soemthing.vbs
there's some fun .bat

hyposmurf

  • Guest
Re: Bat files, want to know more about them
« Reply #8 on: January 20, 2006, 05:21:31 PM »
Thanks Kerry that doenst mean much to me at the moment however Ive taken an old bat file and played around with it to see what can be done.Heres my first bat file.:
Echo off
cls
start /MAX explorer
cls
exit
This opens windows explorer maximised, you can replace /MAX for /MIN and youll get a minimised window explorer window pop up.Yes I could just create a shortcut on my  desktop that wil do the same thing, but at least something Ive worked out. :-) Now Illl have to find out to do something use full with a bat file. :|.The site below is pretty good.


batch tutorial

hyposmurf

  • Guest
Re: Bat files, want to know more about them
« Reply #9 on: January 20, 2006, 05:53:01 PM »
Im trying to open AutoCAD with no avail. :-(Ive tried lots of different combincations and it not worky.For instance tried this:
Echo off
cls
start C:\Program Files\AutoCAD 2004\acad.exe
cls
exit

or just adding acad.exe or acad autocad in place of the search path.Also if I add cmd options like this:

Echo off
cls
start C:\Program Files\AutoCAD 2004\acad.exe
cmd options
cls
exit

Would this open AutoCAD (once ive got the other part correct) and then issue the options command?Maybe I need the echo back on as options is a pop up. :|

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Bat files, want to know more about them
« Reply #10 on: January 20, 2006, 06:01:16 PM »
Code: [Select]
:Test-code.bat  Code
:to substitute drives for specific job .....
C:

 subst J: /D
 subst J: F:\Test_Code

start C:\ACAD2006\acad.exe /p "KDUB_code"   /nologo

If you use spaces in the call, I think quotes are needed ; ie
start "C:\Program Files\AutoCAD 2004\acad.exe"
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Bat files, want to know more about them
« Reply #11 on: January 20, 2006, 06:19:53 PM »
I know you're trying to learn BAT file programming but if you want to make lists of files check my python-tools.
[ http://www.theswamp.org/forum/index.php?topic=3632.0 ]
TheSwamp.org  (serving the CAD community since 2003)