Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Programming Question

Programming Question

Scheduled Pinned Locked Moved The Lounge
questionxml
161 Posts 124 Posters 20 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Dalek Dave

    Who (apart from my good self) still writes .bat files? Are they common or am I one of the old fogies that still employs his DOS knowledge?

    --------------------------------- I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] English League Tables - Live

    P Offline
    P Offline
    PRISMAY
    wrote on last edited by
    #84

    I still use them quite a bit although I use the .cmd files. ;) I use them from anything like running automated encoding on multiple video files to running automated deployment projects on our servers. I am, however, slowly moving towards WSH just because I can use c# but it'll be a while before I'm there and I don't see ever being weaned competely off of the command prompt as it offers too many handy and quick utillities. :) Just another old fogie I guess.

    ------- PRISMAY

    1 Reply Last reply
    0
    • D Dalek Dave

      Who (apart from my good self) still writes .bat files? Are they common or am I one of the old fogies that still employs his DOS knowledge?

      --------------------------------- I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] English League Tables - Live

      R Offline
      R Offline
      RubberSideDown
      wrote on last edited by
      #85

      Been trolling for a while; first post (be gentle). I'm 30 and am a HUGE fan of .bat. I manage a small rogue IT shop full of developers WAY smarter & more talented than I'll ever be, but once in a blue moon I stick them with a task & they fire up all sort of fancy VB & other stuff I don't understand only to end up with a program that has more lines than I want to read & is typically less reliable! Long live the DOS (ok fine... command prompt). TIP: .bat works REALLY well in SSIS packages; I assume shell does too, but I haven't found a need to venture outside my comfort zone.

      1 Reply Last reply
      0
      • D Dalek Dave

        Who (apart from my good self) still writes .bat files? Are they common or am I one of the old fogies that still employs his DOS knowledge?

        --------------------------------- I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] English League Tables - Live

        M Offline
        M Offline
        matt314hew
        wrote on last edited by
        #86

        I am currently writing them at my new job. Mainly they are small things that help me with what I am doing instead of having to manually delete logs. I also wrote them at my old job to do the following: Delete a folder on the Build Server, Get Latest Code, Build the code, and then deploy it.

        1 Reply Last reply
        0
        • T torst3n

          23 and writing them bats, boss. mainly cause I think it's faster then ps scripting and reason is cause I usually need to check if a task is done before I start another one.

          S Offline
          S Offline
          Steven M Hunt
          wrote on last edited by
          #87

          Same here, I'm a young guy and I just wrapped up writing some serious bat files to replace the old mainframe JCL we had hanging around; the government agency I work for (hint: we sent people to the Moon that one time) just turned off our last mainframe this month. -- Steven

          E K 2 Replies Last reply
          0
          • D Dalek Dave

            Who (apart from my good self) still writes .bat files? Are they common or am I one of the old fogies that still employs his DOS knowledge?

            --------------------------------- I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] English League Tables - Live

            S Offline
            S Offline
            Stefan_Lang
            wrote on last edited by
            #88

            Recently wrote some .bat files to automate a nightly build. I know there may be better tools for such tasks, but I still remember bits of DOS from my youth, and therefore can't be bothered to learn another script language. Over the decades I've used various script languages, starting from (C=ommodore) Basic, over BS 2000, Amiga-DOS, Unix sh and bsh, MS-DOS, and a few others, but of these I've only used MS-DOS over the past years. Not because it's so good, but simply because that way I don't need to learn yet another script language :)

            1 Reply Last reply
            0
            • D Dalek Dave

              Who (apart from my good self) still writes .bat files? Are they common or am I one of the old fogies that still employs his DOS knowledge?

              --------------------------------- I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] English League Tables - Live

              P Offline
              P Offline
              PhilLenoir
              wrote on last edited by
              #89

              Yes Dave, but thenI'm another old fart! I use them to ease deployment of new application versions without kicking users out. I drop the new version in the folder, update the BAT file and users pick up the new version on next launch. I also use them to copy new versions to remote sites using a control text file to mark installation (we have lots of sites with slow or unreliable radio links). Now, in the good old days of DOS, I had complete menuing systems running off of BAT files! :-D Phil

              Life is like a s**t sandwich; the more bread you have, the less s**t you eat.

              1 Reply Last reply
              0
              • D Dalek Dave

                Who (apart from my good self) still writes .bat files? Are they common or am I one of the old fogies that still employs his DOS knowledge?

                --------------------------------- I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] English League Tables - Live

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #90

                I still do, just to make my job easier. I've always liked them since I developed my own system with my father's TRS-80 Model I. Setup so, the OS booted and started up BASIC to run games or anything else automatically. They didn't have anything like that long ago... you had to type everything by hand. Now I mainly use it to call my apps to process files and use the batch file to copy the file to the final destination. Multiple projects that interconnect you know. :laugh: :laugh:

                1 Reply Last reply
                0
                • D Dalek Dave

                  Who (apart from my good self) still writes .bat files? Are they common or am I one of the old fogies that still employs his DOS knowledge?

                  --------------------------------- I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] English League Tables - Live

                  P Offline
                  P Offline
                  PSU Steve
                  wrote on last edited by
                  #91

                  My main project is a "self updating" application, but every once in a while we do something that needs a "special" deployment method. I found that a simple BAT file does the trick and prevents the users from royally screwing stuff up...

                  1 Reply Last reply
                  0
                  • D Dalek Dave

                    Who (apart from my good self) still writes .bat files? Are they common or am I one of the old fogies that still employs his DOS knowledge?

                    --------------------------------- I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] English League Tables - Live

                    X Offline
                    X Offline
                    xperroni
                    wrote on last edited by
                    #92

                    32 and I still do. Id' rather use Python, but sometimes an script is intended for someone else's use, and there are lots of Windows XP boxes around here, so I have to go with the lowest common denominator.

                    1 Reply Last reply
                    0
                    • D Dalek Dave

                      Yes Pete, but alas you are venerable and aged, like me. I bet them young whippersnappers don't!

                      --------------------------------- I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] English League Tables - Live

                      S Offline
                      S Offline
                      Smessaert
                      wrote on last edited by
                      #93

                      I'm still quiet young and I use bat in most automated processes: launching applications with parameters. Find which port my harddrive is on before backing-up to it. Dir is still quicker then powershell get-child.

                      1 Reply Last reply
                      0
                      • D Dalek Dave

                        Who (apart from my good self) still writes .bat files? Are they common or am I one of the old fogies that still employs his DOS knowledge?

                        --------------------------------- I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] English League Tables - Live

                        L Offline
                        L Offline
                        LEKnowlton
                        wrote on last edited by
                        #94

                        At my internship, I was recently tasked with automating backups for a 2003 server. The goal was to do it preferably for free, of course ;) I hadn't a need to create a batch file in years, but knew I could get it done. The first batch file uses ntbackup for regular data. The second one does a backup of SQL data by calling TSQL files (.sql) generated in MS SQL Server Management Studio. This allows the SQL server to not have to be shut down to do backups. The third one date-stamps and copies the backup files to other locations. Each batch file is scheduled to run using the built-in Task Scheduler. Free and fun!

                        1 Reply Last reply
                        0
                        • D Dalek Dave

                          Who (apart from my good self) still writes .bat files? Are they common or am I one of the old fogies that still employs his DOS knowledge?

                          --------------------------------- I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] English League Tables - Live

                          C Offline
                          C Offline
                          CarlMon
                          wrote on last edited by
                          #95

                          A developer on my team is nicknamed 'The Batman' for this reason. The rest of us write PS scripts.

                          1 Reply Last reply
                          0
                          • N Nagy Vilmos

                            Like Pete, I use some bat files, but power shell is the way to go.


                            Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

                            P Offline
                            P Offline
                            patfleck
                            wrote on last edited by
                            #96

                            I still use them all the time in EDI systems. For some reason the system I use won't run and exit a .exe correctly unless it is called from a .BAT file. Strange but true...

                            1 Reply Last reply
                            0
                            • D Dalek Dave

                              Who (apart from my good self) still writes .bat files? Are they common or am I one of the old fogies that still employs his DOS knowledge?

                              --------------------------------- I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] English League Tables - Live

                              P Offline
                              P Offline
                              Patricia R Kolb
                              wrote on last edited by
                              #97

                              We use bat files for many applications right now. You are not alone. We have gotten away from the complex bat files we used to have, and now mostly we use them to call exe's and handle a bad return code by sending an email from a vbscript. We have a scheduling tool, but it has many bugs so we are thinking of going back to windows scheduler where the scheduled task is a call to a bat file.

                              1 Reply Last reply
                              0
                              • L Lost User

                                A makefile is nothing more than a batch file with a command line to call the compiler for each source file, then one or more command lines calling the linker and perhaps some commands to deploy or copy the results. An IDE usually lets you edit all kinds of compiler and linker options and then generates the makefile from the contents of your project and those options. Or you can simply write the makefile yourself with any simple editor like wordpad. You just have to know how to call the compiler and linker and what options and parameters your compiler needs or supports. It's just like writing command lines in the console. The makefile only saves you from typing all this every time you want to build your project. I guess, all this should be documented in the compiler's and linker's documentation. Edit: Usually the compiler includes some tool to process the makefile. My simple C compiler for old 8 bit machines does not, so I use plain vanilla .BAT files, which does not really make much of a difference. Whenever I want to build my project, I simply call something like 'make.bat' at the command line and look what kind of results I get in the in the console. Edit^2: I just dug this[^] out in MSDN. It describes how to build from the command line with makefiles and NMAKE. NMAKE is a little more powerful than a simple batch and the commands are not simple command lines anymore, but it's still very much the same idea.

                                I'm invincible, I can't be vinced

                                G Offline
                                G Offline
                                godfetish
                                wrote on last edited by
                                #98

                                NMake can be downloaded from the MSDN directly if you have a 32bit OS. If you have 64bit, then that 16bit NMake download will not run! You have to install the Express Edition or higher of Visual C++ and find it in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin there is another file called nmakeui.dll at C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\1033 but I didn't use it. Why would I go to the trouble? Perl scripts, not wholelly related to .BAT, but a script nonetheless - mine tend to be 20K to 200K per file! On a 64bit Windows OS with no 16bit support like Win7: to install CPAN modules (type cpan at a dos prompt after installing ActiveState Perl), you need Perl, MingW and MSys for the compiler, and NMake. This was fine till we upgraded - well, downgraded my laptop since this $3k Elitebook crashes constantly - to 64bit. I was stuck without the modules and had to figure out a way to get NMake. My Macbook Pro will be here today I hope, btw. Can't wait to get Windows 7 installed on it! Not an Apple fanboi, but I doubt I am going to freeze, BSOD or put up with random sticking letter or key of the day issues...

                                1 Reply Last reply
                                0
                                • D Dalek Dave

                                  Who (apart from my good self) still writes .bat files? Are they common or am I one of the old fogies that still employs his DOS knowledge?

                                  --------------------------------- I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] English League Tables - Live

                                  R Offline
                                  R Offline
                                  RDSchaefer
                                  wrote on last edited by
                                  #99

                                  I do! Although I use the .CMD extension now.

                                  1 Reply Last reply
                                  0
                                  • C CPallini

                                    Right: we young people just write a bunch of shell scripts or awk ones.

                                    Veni, vidi, vici.

                                    S Offline
                                    S Offline
                                    StephenPhillips
                                    wrote on last edited by
                                    #100

                                    I'd consider myself to be in the young 'un category - several months out of university - but I still have uses for .bat files. Most often, I feel the need to have external libraries (Boost, GLFW and SDL being most common) in one place. So to keep them self-contained and properly referenced in my projects, I have .bat files in their respective folders which simply state

                                    setx BOOST_DIR %CD%

                                    or equivalent thereof. Saves me the effort of dealing with changes when migrating to different workstations, and keeps my projects up to date when the libraries are updated. Naturally this only works for systems where I'm allowed to set environment variables in this manner, but in my naive experience it has served me well thus far.

                                    Sometimes a fist in the face says more than a thousand honeyed words.

                                    1 Reply Last reply
                                    0
                                    • D Dalek Dave

                                      Who (apart from my good self) still writes .bat files? Are they common or am I one of the old fogies that still employs his DOS knowledge?

                                      --------------------------------- I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] English League Tables - Live

                                      E Offline
                                      E Offline
                                      englebart
                                      wrote on last edited by
                                      #101

                                      bat/cmd + SendTo shortcuts + GNU utils (sed/grep) One pet peeve with Win7 is that the SendTo folder no longer supports cascading menus via simple folders/directories.

                                      1 Reply Last reply
                                      0
                                      • D Dalek Dave

                                        Who (apart from my good self) still writes .bat files? Are they common or am I one of the old fogies that still employs his DOS knowledge?

                                        --------------------------------- I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] English League Tables - Live

                                        D Offline
                                        D Offline
                                        Dominic Amann
                                        wrote on last edited by
                                        #102

                                        Unless you want the script to be read by the 32 (or even 16) bit interpreter, why wouldn't you write .cmd files instead? Learn bash, and your .cmd skills will improve (and you will start being annoyed at Windows script clumsiness).

                                        1 Reply Last reply
                                        0
                                        • D Dalek Dave

                                          Who (apart from my good self) still writes .bat files? Are they common or am I one of the old fogies that still employs his DOS knowledge?

                                          --------------------------------- I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] English League Tables - Live

                                          B Offline
                                          B Offline
                                          bonjedward
                                          wrote on last edited by
                                          #103

                                          They're useful for calling other programs. For example here if perl is not in the PATH on all PCs - if it is, that's the one to use, but if not, try a known location: perl c:\Offline\Computer\GMobileSubsets\scripts\perl\fetch.pl HNG %1 %2 if ERRORLEVEL 1 goto tryagain exit pause :tryagain C:\perl\bin\perl c:\Offline\Computer\GMobileSubsets\scripts\perl\fetch.pl HNG %1 %2 if ERRORLEVEL 1 goto err exit pause :err pause >nul Perl error! Contact IT. Press any key (I always have pause after exit, so I can quickly add REM in front of exit when testing The same applies in a mixed 32/64 bit environment: C:\Program Files (x86)\ or C:\Program Files\ Also, when calling sequences of taskkill, file copy/delete, etc - you can put a shortcut on the desktop to it. Easier than remembering a long list of services to be restarted in a particular order, etc. Useful for colleagues if your not available - "just log in to the server and click on the shortcut" Also, on Windows 7, some users need local administrator rights to run taskkill, etc, but need their own identity when accessing network files. Create an exe file to run a bat file as admin, but use it only on those batfiles requiring it: C:\Offline\Computer\GMobileSubsets\sw\runaLocalAdmin.exe C:\Offline\Computer\GMobileSubsets\scripts\bat\stopall_reqadmin.bat

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups