acgbox
acgbox

Reputation: 334

how to start wget in cmd with start command and show only progress bar?

I want to download a file with wget portable using start command in cmd, with a batch file, but the window looks bad:

@echo off
start /w wget.exe -q -c --show-progress https://cdn.mysql.com//Downloads/MySQLGUITools/mysql-workbench-community-8.0.23-winx64.msi

enter image description here

What should I add to my command, to reduce the window to the size of the progress bar? (and if possible change the black background color and the color of the letters)

Upvotes: 0

Views: 1072

Answers (1)

Mofi
Mofi

Reputation: 49127

The download progress window could be opened with the wanted properties with following command line:

start "Download Progress" /wait %ComSpec% /D /T:fg /C "%SystemRoot%\System32\mode.com CON COLS=80 LINES=1 & wget.exe -q -c --show-progress https://cdn.mysql.com//Downloads/MySQLGUITools/mysql-workbench-community-8.0.23-winx64.msi"

The Windows command processor cmd.exe processing the batch file starts with command start one more command processor referenced with predefined environment variable ComSpec with the options:

  • /D to disable execution of AutoRun commands from registry,
  • /T:fg to define the foreground and background color (both 0-9A-F) of the console window,
  • /C to execute the command line specified next and then close itself.

The options are explained by the usage help output on running cmd /? in an opened command prompt window.

The title for the console window is Download Progress as defined already by start which waits for self-termination of started cmd.exe instance. Run start /? in command prompt window for help on this command.

The command line executed by the started command process first runs command MODE to change the number of columns to 80 and the number of lines to 1, i.e. the additional console window becomes very small. Run mode /? in command prompt window for help on this command.

The small additional console window displays only the progress information of wget.exe which is executed next by the second command processor instance.

See also single line with multiple commands for an explanation of the operator &.

Upvotes: 1

Related Questions