Hot answers tagged

2

They sure do refer to the same title. It is the title that appears within the top border of your window. The problem is your START /B switch causes the process to be launched within the same console window, and a window can only have one title. START does not change the title of the window if the /B switch is used. Run your START command with the /B switch, ...


2

Method 1: open cmd and type: FOR %A IN ("C:\SourcePath\*.m4a") DO ffmpeg -i "%~A" -vn -c:a copy "C:\OutputPath\%~NA.aac" Method 2: open cmd and type: FOR %A IN ("C:\SourcePath\*.m4a") DO ffmpeg -i "%~A" -vn -acodec copy "C:\OutputPath\%~NA.aac" Both of them work.


2

I want to count the number of lines in a file using batch Specific solution From a command line: F:\test>for /f "usebackq" %b in (`type abc.csv ^| find "" /v /c`) do @echo line count is %b line count is 1 From a batch file (countlines.cmd): @echo off Setlocal EnableDelayedExpansion for /f "usebackq" %%b in (`type abc.csv ^| find "" /v /c`) do ( ...


2

Actually, the current answer isn't out of date. I tried the exact same thing on Windows 10 and was able to add Run Batch script to the context menu of all folders in Windows. This is the content of my batch script (won't work with UNC paths): @ECHO OFF ECHO %~n0 was called with the following arguments: SET args=%* IF NOT DEFINED args GOTO END ECHO %* :END ...


1

I would recommend Default Programs Editor for this task. It is both more user friendly and arguably safer than editing the registry directly. Choose Context Menu Select the extension you want to change. Choose Add... Give your command a Title, browse to the batch file and optionally pick an icon to represent your command. Save the context menu to ...


1

for auto closing of the CMD window, just make a BAT file with powercfg -s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c in it only. It will auto close, don't need echo off or Pause commands in there.


1

A simple way to count the number of lines in a file on a Microsoft Windows system is by using the following command: find /v /c "" somefile.txt The /c option counts the number of lines while the /v option displays all lines NOT containing the specified string. Since the null string, i.e. "", is treated as never matching, you should see the number of lines ...


1

How do I permanently set the PATH from a cmd shell? You need to use setx instead of set. Example: SetX PATH "c:\my dir;%PATH%" Notes: "s are recommended in case any of the path elements contain spaces. The cmd shell should be run as Administrator. Use /m to set the PATH in the system environment instead of the user environment. Warning: See my ...


1

The French accents are not copying properly Add chcp 1252 (West European Latin) to the start of the batch file. Without this I can reproduce your problem (my default code page is 850 - Multilingual (Latin I) With it added I get the expected text on the clipboard. Example 1: F:\test>type test.cmd echo systÞme | Clip F:\test>test F:\test>echo ...


1

How can I find out the mac addresses of all bluetooth devices the adapter has detected? Some possiblilites: BluetoothCL (command line) BluetoothView (GUI) BluetoothLogView (GUI, with logging) BluetoothCL from Nirsoft BluetoothCL is a small console application that dumps all current detected bluetooth devices into the standard output. For each ...


1

You should read some documentation. You can start by typing help if or if /? from the command line, and if you read carefully, you will see one problem with your logic. IF ERRORLEVEL 0 means "return TRUE if ERRORLEVEL is >=0". This will always be true after running FINDSTR. If you did not have the TIMEOUT before your IF, then you could simply use the IF ...


1

It's all in docs. Just add -cur_console:n switch at the end.


1

I found a solution! I used this code in order to get the bat to open the three different bat files independently: cd "\directory\bat1\" start bat1.bat cd "\directory\bat2\" start bat2.bat cd "\directory\bat3\" start bat3.bat


1

If you use start, the other bat-files will create new process for each bat, and run them all at the same time. cd "\directory\bat1\" start bat1.bat cd "\directory\bat2\" start bat2.bat cd "\directory\bat3\" start bat3.bat But if you want to run the next one after the last one is finished, you can use call cd "\directory\bat1\" call bat1.bat cd ...


1

Try %% e.g. for %%f rather than for %f, that might work In batch files you have to use for %%f rather than for %f The for %f is only for the command line. Change all references, so I suppose %%~zA rather than %~zA You should really have troubleshooted and tried even a simple for loop, like for %a in (*.*) do @ECHO %a you'd then have realized it also ...


1

Pipe operator | is a special character and can not be ECHOed as is. You need to escape it with ^. Here's the correct script @echo off Title Epidsode one Season one Echo Early Alpha 0.01 Echo CLOSED FOR TESTING CFT Pause Echo 0 \0/ ^|0__ \0 __0 0/ 0/ __0^| Echo /^|\ ^| ^| ^|\ /^| ^| /^| ^| Echo / \ / \ / \ / \ / ...


1

Give a try for this example to start Chrome.exe and kill all its PID(s) after launching it ! @echo off set MyProcess=Chrome.exe start "" %MyProcess% setlocal EnableDelayedExpansion for /f "TOKENS=2" %%a in ('tasklist /NH /FI "imagename eq %MyProcess%"') do ( Set PID=%%a & echo The PID of %MyProcess% = !PID! Echo( & Echo To Kill all PID of ...


1

Batch can't handle floating point numbers, only integers. So ((1*6)/8) = 0 instead of 0.75. You then try to divide (2*2) by that 0, giving you a "Divide by zero" error. Suggested solution? Use PowerShell instead: PS Y:\> $hp = 50 - ((2*2)/((1*6)/8)) PS Y:\> $hp 44.6666666666667 Related SU question: How to set the arithmetic precision in ...


1

Batch operation returns "Divide by zero error" set /a "hp = 50 - ((2*2)/((1*6)/8))" This is because 1*6 = 6 and 6/8 = 0.75. And: Any SET /A calculation that returns a fractional result will be rounded down to the nearest whole integer. So 0.75 is rounded down to 0. 6/0 returns "Divide by zero error". Workarounds There are no real ...


1

I was wondering if there is a way to automate this The easiest way to automate this is to save the links in a file and then use for /f to process the links file. Use the following batch file (links.cmd): @echo off setlocal enabledelayedexpansion set "folder=M:\\Voot" if not exist %folder% md %folder% set quality=high set ...


1

Why a batch file? Is powershell an option? Here is the entire powershell command you would need. Get-Content filename | % { "<option value=`"$_`">$_</option>"} A text editor with a search and replace that supports regular expression and backreferences would also make this easy. You would search for this ^(.*)$, and replace it with <option ...


1

When you type netsh at the Command Prompt (cmd) prompt, you start running the netsh.exe program.  The next three lines are input to that program, and are read and processed by that program. cmd isn't set up to allow that sort of thing in a .BAT file.  But you can do the following workaround to make the netsh-related commands be input to netsh: (echo ...


1

You need to put the entire command on one line so that it gets passed to the netsh executable. netsh interface ip set address "lan" static 192.168.30.77 255.255.255.0 192.168.30.2


1

I need to get rdp-tcp#26 and use in next command as tscon SESSIONNAME /dest:console Use the following batch file: @echo off for /f "usebackq tokens=1" %%i in (`qwinsta administrator ^| findstr Administrator`) do ( set _temp=%%i set sessionname=%_temp:~1% ) tscon %sessionname% /dest:console endlocal Further Reading An A-Z Index of the Windows ...



Only top voted, non community-wiki answers of a minimum length are eligible