I'm thinking if does exist some kind of software that can put in a queue a bunch of windows commands. For example I can say to first copy some file somewhere, then rename those, then delete the old files, then edit one of them etc. without waiting the effective execution of any of those passages. This could be useful when copying big files that take a lot and I don't want to sit in front of the computer keeping the eyes on the progress bar.

Does anything like this exist?


easiest thing to do is to write a batch file for what you want do, for example open notepad and copy the following:

@echo off
echo Starting batch script
copy c:\temp\*.* c:\temp2\*.*
del c:\temp2\test.exe
echo all file operations complete

Next, save this somewhere as anything .bat and you can run it either by double clicking, or going to the command prompt and typing its name. All operatings you write in it will get processed in order.

  • yes i know this solution, but it's a bit frustrating to write down paths everytime... this functionality should be integrated wihtin windows, but they are too lazy :( – Stefano Nov 5 '09 at 23:16
  • 2
    So... you're looking for a program that "knows" where you want to copy files and which ones you might want to edit? How about in Wil's example change the paths with variables: copy %1% %2% ?? – DaveParillo Nov 5 '09 at 23:35
  • What about tasks that normally don't use commands? For example drag and drop task, or context menu tasks. I'd love to have 7zip wait for previous extract to finish before starting a new extraction. – syockit Jan 18 '11 at 17:11
  • @syockit - used the 7zip command line version, extract to a temporary directory, do the operations on that etc. There is nearly always a way to use the command line for anything! – William Hilsum Jan 18 '11 at 18:11
  • 4
    @Syockit - you can actually modify a .bat whilst it is running, and if it hasn't reached that line yet, it will run the new command... E.g. if I write "echo test, pause" and during the pause, I modify to "echo test, pause, echo blabla"... when I press enter, I will actually see blabla. – William Hilsum Mar 1 '11 at 18:18

I wrote this little batch script some time ago called QSTART. Maybe it will help.

It allows you (in theory) to create and execute queues of any BATCH commands. Queues are plain text files stored in %TEMP% directory.

It's a very simple script I use i.e. to queue zip commands when doing backups.

I didn't do much debugging, therefor feel free to correct any existing bugs. I'm not 100% sure if it handles properly every BATCH command string, but it should suit for simple tasks.

Important. Every queued command is executed exactly as it is. The script doesn't check for any errors, but simple ERRORLEVEL validation inside the FOR loop can fix that.

Also I'm not a professional programmer and am aware that the script is a bit messy (ie. I didn't know any other way to run queued command; the built-in START command sometimes doesn't work for me).

There is help and some examples at the end of the script. Use QSTART without arguments to display it.

@echo OFF

rem qstart root directory
set ROOT=%~dp0
call :DEBUG "qstart root directory: %ROOT%"

rem queue storage directory
set QDIR=%TMP%
call :DEBUG "queue directory: %QDIR%"

rem 1.parameter (mandatory) - queue ID
rem if no queue ID given display help message
set QID=%~1
call :DEBUG "queue ID: %QID%"
if "%QID%"=="" goto :MSG_HELP
call :DEBUG "queue file: %QFILE%"

rem 2. parameter (mandatory) - queue operation
set QOP=%~1
call :DEBUG "queue operator: %QOP%"

if "%QOP%"=="add" goto :QADD
if "%QOP%"=="list" goto :QLIST
if "%QOP%"=="load" goto :QLOAD
if "%QOP%"=="new" goto :QNEW
if "%QOP%"=="remove" goto :QREMOVE
if "%QOP%"=="run" goto :QRUN
if "%QOP%"=="save" goto :QSAVE

rem add command to queue
rem create queue if not exists
    if not exist "%QFILE%" call :QNEW
    set QCMD=:
        set QCMD=%QCMD% %1
        if not "%~1"=="" goto :NEXTPAR
    set QCMD=%QCMD:: =%
    call :DEBUG "queued command: %QCMD%"
    echo %QCMD% >>"%QFILE%"
    goto :EOF

rem list queued commands
rem warn if queue not exists
if not exist "%QFILE%" (
    call :ERR_BADQID
) else (
    type "%QFILE%"
goto :EOF

rem import queue from file
rem create queue if not exists
rem warn if file not exists
    if not exist "%QFILE%" call :QNEW
    set FILE=%~1
    call :DEBUG "load file: %FILE%"
    if not exist "%FILE%" (
        call :ERR_NOFILE
    ) else (
        copy /B /Y "%QFILE%"+"%FILE%" "%QFILE%" >NUL
    goto :EOF

rem clear queue
rem create queue if not exists
    if exist "%QFILE%" call :QREMOVE
    copy /B /Y NUL "%QFILE%" >NUL
    goto :EOF

rem remove queue
rem warn if queue not exists
    if not exist "%QFILE%" (
        call :ERR_BADQID
    ) else (
        del /F /Q "%QFILE%" >NUL
    goto :EOF

rem execute queued commands
rem clear queue after execution
    if not exist "%QFILE%" (
        call :ERR_BADQID
    ) else (
        for /F "tokens=* delims=" %%C in (%QFILE%) do (

            rem alt.way of execution: start "" /B /WAIT %%C

            call :DEBUG "ERROR LEVEL of last operation: !ERRORLEVEL!"
        rem call :QREMOVE
        call :QREMOVE
    goto :EOF

rem export queue to file
rem warn if queue not exists
rem overwrite file if exists
    set FILE=%~1
    call :DEBUG "save file: %FILE%"
    if not exist "%QFILE%" (
        call :ERR_BADQID
    ) else (
        copy /B /Y "%QFILE%" "%FILE%" >NUL
    goto :EOF

rem messages ------------------------------------------------------------------

rem bad syntax error
rem show help
    echo ERROR: syntax error
    call :MSG_HELP
    goto :EOF

rem bad queue id error
    echo ERROR: bad queue ID '%QID%'
    goto :EOF

rem file not found error
    echo ERROR: file not found '%FILE%'
    goto :EOF

rem usage information
    echo qstart v.0.1.5 - by rapia19@interia.pl
    echo Allows to create and execute queues of BATCH commands.
    echo        qstart {-h^|--help^|?^|/?}
    echo   {QUEUE_ID}          queue ID
    echo   {QUEUE_OPERATOR}    queue operator
    echo   {COMMAND}           queued command call
    echo   {FILE}              import/export filename
    echo   -h --help ? or /?   shows ^(this^) help message
    echo Allowed operations:
    echo   add {COMMAND}   adds command to the queue
    echo   list            lists all queued commands
    echo   load {FILE}     imports ^(appends^) queued commands from a file
    echo   new             creates new or clears existing queue
    echo   remove          deletes queue
    echo   run             executes all queued command and deletes queue
    echo   save {FILE}     exports queue to a file
    echo ALSO:
    echo   set QDEBUG=1    turns on displaying debug messages
    echo EXAMPLES:
    echo   qstart Hello add echo "Hello world!"
    echo   qstart Hello add pause
    echo   qstart Hello list
    echo   qstart Hello save Hello-copy.txt
    echo   qstart Hello new
    echo   qstart Hello load Hello-copy.txt
    echo   qstart run
    goto :EOF

rem display debug message and pause
    if "%QDEBUG%"=="1" (
        echo ### DEBUG INFO ### %~1
        pause >NUL
    goto :EOF
  • Ahum, "little" batch script? Nice! – Arjan Feb 8 '14 at 12:49

You could also consider GNU Make for Windows. It's a single binary (as opposed to a typical scripting language), and can run different sequences of commands from one Makefile, with fine-grained control to continue or abort on any individual command failing. It also has much better per-target variable propagation and substitution mechanisms than a batch script.

I use it frequently to store and invoke short command sequences on Windows that I run more than once or twice, especially if I create the command sequence at a certain time and need to run it later.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.