1

I have this in batch and the code works without start /low. While compressing with wzzip the CPU is 100% and all other programs hang.

So to fix this issue I've been trying to either set affinity or priority, but with start /low inserted I continue to get error:

Windows cannot find '-ez'

Any help with this would be appreciated.

for /f "tokens=*" %%a in ('type "%Path%\dirlist.txt"') do (
start /low "c:\program files\winzip\wzzip" -ez -md "%%a.zipx" "%%a"
CLS

Thanks for the feedback. With it I was able to make it run in priority low.

start "" /b /low /wait "c:\program files\winzip\wzzip.exe" -ez -md "%%~a.zipx" "%%~a"

It was very important to use /wait command otherwise if you are using a for loop the program wzzip.exe runs all instances at once instead of running one then waiting for it to complete before running another.

Additionally, I changed the cpu core usage to 1 by using /affinity 0x1

start "" /b /low /affinity 0x1 /wait "c:\program files\winzip\wzzip.exe" -ez -md "%%~a.zipx" "%%~a"

Thanks for all the help.

0

1 Answer 1

0
@echo off 

set "_wzzip="c:\program files\winzip\wzzip.exe"
for /f tokens^=* %%a in ('type "d:\Folder\Subfolder\dirlist.txt"
')do start "" /b /low /wait /affinity 0x1 "!_wzzip!" -ez -md "%%~a.zipx" "%%~a" && (
"%__APPDIR__%wbem\wmic.exe" process where 'name="wzzip.exe"' CALL setpriority "idle")

About: Windows cannot find -ez, try to add "" and .exe in:

start "" /b /wait /low /affinity 0x1 "!_wzzip!" -ez -md "%%~a.zipx" "%%~a" 

You can replace the %path% variable with the full file dirlist.txt:

for /f tokens^=* %%a in ('type "%path%\dirlist.txt"')

for /f tokens^=* %%a in ('type "d:\Folder\Subfolder\dirlist.txt"')

Start your command by adding pertinent arguments/flags so that it starts in the background:

start "" /b /wait /low /affinity 0x1 "!_wzzip!" -ez -md "%%~a.zipx" "%%~a" 

After running the command above in background, make a call to the wmic console setting the wzzip.exe process to idle

"%__APPDIR__%wbem\wmic.exe" process where 'name=wzzip.exe"' CALL setpriority "idle"

[√] Find

[√] Conditional Execution || && ...

[√] wmic in Microsoft Documents /online

[√] wmic setpriority "idle" sources from @Bobs questio and answer

0

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.