How often do you use batch files to automate tasks?

Discussion in 'polls' started by Mrkvonic, Jan 5, 2007.

?

How often do you use batch files to automate tasks?

  1. Quite often; they are highly useful

    19 vote(s)
    30.6%
  2. Sometimes, when something really boring needs to be done

    14 vote(s)
    22.6%
  3. Very very rarely or am afraid to try

    10 vote(s)
    16.1%
  4. Never, I don't know what they are

    19 vote(s)
    30.6%
  1. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    8,698
    Hello,
    I was wondering how many of you use batch files, combined with scheduling, to perform backups, defragmentation and similar household maintenance duties.
    Mrk
     
  2. Meriadoc

    Meriadoc Registered Member

    Joined:
    Mar 28, 2006
    Posts:
    2,642
    Location:
    Cymru
    Yeah,
    best way for me to simplify the management of a computer.
    ...everything mentioned. Anything to save time with a repetitive task.
    shutdown, backup data/networked PCs/directories, cleaning up, renaming, downloading, defrag...any of these with/without a schedule, when I need to customise a program.
     
  3. gerardwil

    gerardwil Registered Member

    Joined:
    Jan 17, 2004
    Posts:
    4,748
    Location:
    The Netherlands
    Hi Mrk,

    Never :)
    Those activities I only carry out when I think it is necessary and does not interrupt my other work.

    Gerard
     
  4. TairikuOkami

    TairikuOkami Registered Member

    Joined:
    Oct 10, 2005
    Posts:
    2,509
    Location:
    Slovakia
    I use batch only after clean instal to remove some files, but I am still looking for its functions.
     
  5. ASpace

    ASpace Guest

    I use them rarely on my personal computer but more often to install NOD32 EE faster and preconfigured on clients' machines . Also at the office some use them to run some old DOS programs :p
     
  6. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    8,698
    Hello,
    I use them quite often, to perform backups, cleanups, defrags etc.
    Mrk
     
  7. lucas1985

    lucas1985 Retired Moderator

    Joined:
    Nov 9, 2006
    Posts:
    4,047
    Location:
    France, May 1968
    Quite often (audio and system related tasks). Also, I´m learning scripts.
     
  8. WSFuser

    WSFuser Registered Member

    Joined:
    Oct 7, 2004
    Posts:
    10,632
    i dont use batch files; or maybe i do but dont know.
     
  9. TairikuOkami

    TairikuOkami Registered Member

    Joined:
    Oct 10, 2005
    Posts:
    2,509
    Location:
    Slovakia
    Can someone please post his batch files, I would like to see, what it can do. This is mine.
     
  10. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    8,698
    Hello,

    Here's an example for creating virtual hard disks using qemu.
    This is for creating a 8GB .vmdk hard disk for VMware.

    c:
    cd \
    cd program files\qemu
    qemu-img.exe create -f vmdk generic_8G.vmdk 8G
    copy generic_8G.vmdk g:\0_generic_hard_disks
    del generic_8G.vmdk

    Save as a text file and then simply change the extension to .bat.

    I have some 15-20 scripts running, in Linux even more.

    Mrk
     
  11. herbalist

    herbalist Guest

    I use quite a few batch files. They're incredibly useful, especially on the DOS based systems. BTW, if you like automating tasks with batch files, take a look at Launchkey. It's great for use with batch files, enabling you to send keypresses to apps. It can also send mouseclicks to apps that weren't designed to accept keyboard entries. I use it in several batch files, including one that ran ID blaster for one cycle each time my modem dialed out. Here's how to work ID blaster with Launckey via a batch file. My scheduler has a "window watcher" feature than can run an app when a specified window is detected, in this instance, the dialup connection window.
    Code:
    @echo off
    C:\launchkey "{WAIT=2000}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{enter}{WAIT=500}{ALT}{WAIT=200}FE" "C:\PROGRAM_FILES\ID_BLASTER_PLUS\IDBLASTERPLUS.EXE"
    
    I use Launchkey with Clipboards in several batch files that capture several screenshots at short intervals. With the Launchkey path being C:\launchkey.exe and Clipboards running in the tray, this batch file will capture 9 active window screenshots at .5 second intervals:
    Code:
    @echo off
    C:\Launchkey "%%{PRINTSCREEN}"
    C:\Launchkey "%%2"
    C:\Launchkey "{WAIT=500}%%{PRINTSCREEN}"
    C:\Launchkey "%%3"
    C:\Launchkey "{WAIT=500}%%{PRINTSCREEN}"
    C:\Launchkey "%%4"
    C:\Launchkey "{WAIT=500}%%{PRINTSCREEN}"
    C:\Launchkey "%%5"
    C:\Launchkey "{WAIT=500}%%{PRINTSCREEN}"
    C:\Launchkey "%%6"
    C:\Launchkey "{WAIT=500}%%{PRINTSCREEN}"
    C:\Launchkey "%%7"
    C:\Launchkey "{WAIT=500}%%{PRINTSCREEN}"
    C:\Launchkey "%%8"
    C:\Launchkey "{WAIT=500}%%{PRINTSCREEN}"
    C:\Launchkey "%%9"
    C:\Launchkey "{WAIT=500}%%{PRINTSCREEN}" 
    The time intervals are in milliseconds, defined by {WAIT=500}. To convert to full screen captures, edit each instance of
    C:\Launchkey "{WAIT=500}%%{PRINTSCREEN}"
    to
    C:\Launchkey "{WAIT=500}%{PRINTSCREEN}"

    When I had BitDefender and Acronis installed, I didn't want all the extra autostart entries they created. I removed all their autostart entries from the registry and a used batch file to start the necessary processes when I wanted to use one of them.

    I also use batch files to copy my registry and core system files and overwrite them with the archived copies during each reboot. They're described
    here. The ones I use also delete the index.dat files.
    I also use a modified version of these to extract a separate registry and other system files from an encrypted archive, and replace the default copies during a reboot. I have several apps installed in this encrypted partition that run normally when the alternate files and registry are used, but there's no evidence of their existence when the default system is running. Almost a hidden operating system. These batch files also make use of the DOS component of eraser to destroy the alternate files when I switch back to the default system.

    DOS and batch files are one of the reasons I stay with Win98. While it's not nearly as powerful as Linux command line, you can do a lot at a system level that isn't possible on an NT system.
    Rick
     
  12. Meriadoc

    Meriadoc Registered Member

    Joined:
    Mar 28, 2006
    Posts:
    2,642
    Location:
    Cymru
    depends
    start program maximised START /M C:\WINDOWS\NOTEPAD.EXE
    remotedown.bat...shutdown -s -m \\name
    restart.bat...shutdown -r
    tmpclean.bat...c:\windows\command\deltree /y c:\windows\temp
    del c:\windows\tempor~1\*.zip
    del c:\windows\tempor~1\*.exe
    then quicken up a bit more by having sortcuts/key press for the files.
     
  13. TairikuOkami

    TairikuOkami Registered Member

    Joined:
    Oct 10, 2005
    Posts:
    2,509
    Location:
    Slovakia
    Well, it seems that bat is quite usefull, I shall look at it. Thanks to all.
     
  14. EASTER.2010

    EASTER.2010 Guest

    With my other (dual-drive) 98SE i made extensive use of batch files, and also plenty of VBS files also. I need to get back into the swing of things with them again. I done some incredible "MAGIC" on my Win98SE with those files and actually had fun working with them. I used them to AUTOMATE about anything my heart desired and i was never disappointed once.

    Thanks for the reminders. Very worthwhile.
     
  15. nadirah

    nadirah Registered Member

    Joined:
    Oct 14, 2003
    Posts:
    3,647
    I use batch files to automate downloading of my favourite porn videos from porn sites. Just joking. :D

    I never use batch files at all even though I know of them. Just my personal preference as I prefer to perform tasks manually by myself.
     
  16. The Gorilla

    The Gorilla Registered Member

    Joined:
    Apr 11, 2005
    Posts:
    66
    Location:
    England
    Would not have a clue what to do,

    Any ideas where the easiest place to learn is?
     
  17. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    8,698
    Hello,
    How about here?
    Plus, Linux is the father of CLI. DOS is a mother of CLI.
    You could install FreeDOS in VMware and then play with DOS. I have an article about that.
    Mrk
     
  18. lucas1985

    lucas1985 Retired Moderator

    Joined:
    Nov 9, 2006
    Posts:
    4,047
    Location:
    France, May 1968
    This thread.
    Mrkvonic´s site :D
    Google
    Link1
    Link2
    Book
    :thumb:
     
  19. Anti_Virus

    Anti_Virus Registered Member

    Joined:
    Feb 3, 2007
    Posts:
    26
    Cleaning disk,
    Defragmentation and finally,
    for shutting-down the PC. :)
     
  20. progress

    progress Guest

    Never, I think there is no reason to use them nowadays :)
     
  21. axial

    axial Registered Member

    Joined:
    Jun 27, 2007
    Posts:
    477
    I often use batch files, every day.
    One example I use the Microsoft DevCon utility

    http://msdn.microsoft.com/en-us/library/ms792824.aspx

    to rescan attached devices, so that external SATA drives can be hotplugged in/out and their drive letters removed on demand.

    I have a batch file called "RescanDrives.cmd" which contains the following:

    c:\progra~1\utils\DeviceConnection\devcon.exe rescan
    pause

    and on my desktop I have an icon called "Rescan" that calls the batch file as the target, e.g.
    "C:\Program Files\Utils\DeviceConnection\RescanDrives.cmd"
     
  22. Eice

    Eice Registered Member

    Joined:
    Jan 22, 2009
    Posts:
    1,413
    I use two: one for launching a legacy game and all its helper applications so that all I have to do is run that one batch file as administrator. The other one is as follows:
    Code:
    cd /d D:\Programs\Chromium
    bitsadmin /transfer latest http://build.chromium.org/buildbot/snapshots/chromium-rel-xp/LATEST %temp%\LATEST
    setlocal enabledelayedexpansion
    set SEPARATOR=/
    for /f "delims=" %%a in (%temp%\LATEST) do (
    	set filecontent=%%a
    	)
    bitsadmin /transfer chrome http://build.chromium.org/buildbot/snapshots/chromium-rel-xp/%filecontent%/chrome-win32.zip %temp%\chrome-win32.zip
    rd /s /q Chromium-backup
    ren Chromium Chromium-backup
    "c:\Program Files\7-zip\7z.exe" x %temp%\chrome-win32.zip
    ren chrome-win32 Chromium
    del %temp%\LATEST
    It's scheduled to run at 5am every day. Very convenient indeed.
     
  23. demonon

    demonon Guest

    I use them a few times a week.
    They are higly useful once you know what their capability.
     
  24. lodore

    lodore Registered Member

    Joined:
    Jun 22, 2006
    Posts:
    9,006
    Daily!
    I use a batch file to image my system Daily.
    I dont see the point in using a batch file for defrag. I simply create a shortcut for JKdefrag and add the commandline parameters on the end and then add to task Scheduler. same sort of thing for CCleaner really add Scheduled task and add the commandline parameters.
    I also have a batch file for starting 4OD to i dont have to have the service running all the time and dont need the auto start entrie.

    eeek just looked at the thread start date holy thread resurrection batman!
     
    Last edited: May 22, 2009
  25. TonyW

    TonyW Registered Member

    Joined:
    Oct 12, 2005
    Posts:
    2,634
    Location:
    UK
    Not using any batch files.
     
Loading...