Tag Info

New answers tagged

1

For posterity, the powershell script I have used is: Get-Childitem C:\MyDirectory -Recurse | WHERE { -NOT $_.PSIsContainer } | Group Extension -NoElement | Sort Count -Desc > FileExtensions.txt Also, you could potentially run it from the command line/batch file: Powershell -Command "& Get-Childitem C:\MyDirectory -Recurse | WHERE { -NOT ...


0

You may also refer to the following step by step guide on how to batch remove subtitles from MKV This guide also applies to remove subtitles from MP4, AVI, FLV, WebM, OGV, VOB, MPEG, RMVB, WMV, WTV and etc.


0

Have you tried adding to your .bat file a cd command like cd /d c:\estetica\? Please post the exact error messages you're getting. call is not really supposed to be used to run .exe files, only batch files.


5

I see a number of problems with your code. But I cannot see how you are getting the behavior you describe. 1) You are counting all files, but your code to get the newest and delete all only works with .jpg files. Your count should also be restricted to .jpg files. 2) You forgot to use delayed expansion in your START line. But really, there is no need to ...


1

Your logic says: If counter = 4 then for each jpg in the folder start exe. Setting the counter to 0 inside the loop, after you already determined it equalled 4, is not going to stop the loop. You also have an incomplete IF statement, caused by an extra closing bracket (before the :BREAK) that's messing with your ELSE statement. Hope that helps!


0

Re the path error, you probably need to give the full path to the program (e.g., C:\Something\SomethingElse\program.exe not just program.exe).


1

Use DIR /ad to filter directory listings to contain only directories entries.


0

The problem is the expansion of the variable. If the variable is modified inside the for block of code, to access its value inside the same block you need delayed expansion. But you can not do something like !lineString:!to_replace!=! as the parser will interpret the opening ! in to_replace as the termination og lineString. So, you have two options. The ...


0

When using EnableDelayedExpansion you must also use ! around variables you want to delay expanding. Therefore, instead of %CHOICE1% you must use !CHOICE1!.


2

Given that CMD.EXE is woefully under-documented, I'm not sure what the expected behavior should be. I certainly haven't seen any documentation as to what the expected behavior is. So I think you will be hard pressed to find anyone that could give a definitive answer as to whether any of the behaviors are a bug. But I agree it certainly is inconsistent, and ...


0

You only have 2 choices. 1) Change your current directory within your sample.cmd script: pushd d:\dev\sys start /wait cmd.exe /c fix.bat But you have stated you don't want to do that. 2) The only other choice is to modify fix.bat to change the current directory to where it is executing. The simplest way to do this is to add the following line at (or ...


0

There are several options:- Create a link using explorer: locate fix.bat, right click, select Copy, right click elsewhere and select Paste Shortcut; now rename to get rid of "Shortcut to " from the name and maybe the ".bat" as well: then change your parent command to call D:\dev\sys\fix.lnk instead of D:\dev\sys\fix.bat and the link will set the directory. ...


0

I already have this VBScript to clean up this folder. How can I add the extra command to skip the 'DoNotDelete.txt' file? Can you help? Regards, JvD Dim fso, startFolder, OlderThanDate Set fso = CreateObject("Scripting.FileSystemObject") startFolder = "D:\tmp" ' folder to start deleting (subfolders will also be cleaned) OlderThanDate = ...


1

Here's a start. There's just one slight issue: the last item in the JSON block still ends with a comma, but this code snippet will get you going. @echo off Setlocal EnableDelayedExpansion set first=1 for /f "tokens=1,2" %%i in (input.txt) do ( if "%%i"=="code:" ( if !first! neq 1 ( echo } ) echo ...


0

Here is a simple Batch Scripts that execute the task that you have requested: @echo off setlocal EnableDelayedExpansion for /f "delims=. tokens=1-3" %%l in ('dir /a-d /b') do ( set FILENAME=%%l set EXTENSION=%%m set PARTNUMBER=%%n if defined PARTNUMBER ( ren ".\!FILENAME!.!EXTENSION!.!PARTNUMBER!" "!FILENAME!_!PARTNUMBER!.!EXTENSION! ) ...


0

You can use Windows Sysinternals "Process Explorer" utility to find out which process started the batch script. Find cmd.exe process that is executing the batch script commands. The process above the cmd.exe process is the process started the batch file. if there are multiple cmd.exe processes you can view the command line for each cmd.exe process by ...


0

Looks like this is what i wanted :D @echo off :start cls echo **************************************************************************************** echo * FILERENAMER * echo * * echo * ...


0

It doesn't seem to work with the relative path as others suggested. This is what worked for me: Simply add %~dp0 in front of the file name and it will fill in the direct path to the batch file. So as long as the .reg file is in the same folder as the batch file you are good to go. For example: regedit.exe /s %~dp0registryfile.reg


-1

This command netsh wlan show all saved me from paintfull seach that my wlan service WLAN AutoConfig somehow was disable.


0

I don't think forfiles has such an option (type 'forfiles /?'). As a workaround, you could (temporarily) set one of the system, read-only or hidden attributes on this file, e.g. attrib +h donotdelete.txt. This will prevent forfiles from deleting it.


-1

If you are happy to run a batch file along with a couple of tiny helper programs, a complete solution is posted by me here: How can a batch file run a program and set the position and size of the window? Contents as below . . . . This demo batch file will run a command-line program and set the position and size of its Command Prompt console window. The ...


0

For sure it is possible! Look if you have the chance to use powershell instead of batch (which is old). Powershell is more clearer to read than batch and most of the time you have access to powerfull tools. Gonna give you a good help to start (if you use Powershell): Get-ChildItem -Path "c:\folder\to\start\scan" -Filter *.pdf -Recurse | select-object ...


0

Solution The only purpose of the timeout command is to wait: This utility accepts a timeout parameter to wait for the specified time period (in seconds) or until any key is pressed. It also accepts a parameter to ignore the key press. Source: timeout /? If you want to start foo.exe afterwards, you can use something like this: timeout /t -1 ...


0

The logic is: ping public ip (google dns 8.8.8.8), if the ping fails, then goto :RESTART and restart network adapter with name "LAN", after this loop again from the start (if ping is OK, then do nothing and ping in loop to check if adapter is connected to internet) @echo off :LOOP ping 8.8.8.8 IF ERRORLEVEL 1 goto RESTART IF ERRORLEVEL ...



Top 50 recent answers are included