The following code works great at extracting any zip-type files in current directory and subdirectories below. It will create a directory with the name of the zip file and extract the contents into that directory. This is great, but if you have test.zip and test.rar in the same directory, this is a problem if you don't want the contents of the rar and zip outputting to the same "test" directory. I would like it to extract to a directory with the zip name including extension. In other words, extract test.zip into a folder called "test.zip" and test.zip to a folder called "test.rar" -- to avoid file name collisions.
for /F "DELIMS=" %%I IN ('dir /b /s *.zip *.rar *.7z') DO ( "C:\Program Files\7-Zip\7z.exe" x -aos -o"%%~dpnI" "%%I" )
I thought this could simply be done by changing -o"%%~dpnI" to -o"%%~dpnxI", but that didn't seem to work. Please help!