An organizer batch

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Rafhack
Posts: 19
Joined: 23 Feb 2014 15:02

An organizer batch

#1 Post by Rafhack » 05 May 2014 09:56

This code can organize files by type. It querys on Windows registry for the file types, then gets its names.
You just need to execute it on your messed folder, even on desktop.

Code: Select all

@echo off
setlocal enabledelayedexpansion
for %%j in (*.*) do (
call:extencao "%%j"
)
echo/Concluido&pause>nul&exit
:extencao
if "%~1" == "%~nx0" (
 goto continue)
echo/%~1
set "ext=%~x1"
for /f "tokens=3" %%a in ('reg query hkcr\!ext! /ve') do (
for /f "tokens=3*" %%m in ('reg query hkcr\%%a /ve') do (
set "nome=%%m %%n")
)
md "%nome%" 1>nul 2>nul
move "%~1" "%nome%" 1>nul
:continue

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: An organizer batch

#2 Post by foxidrive » 05 May 2014 16:47

A fix for undefined filetypes is all it seems to need:

Code: Select all

abc.md5
ERROR: The system was unable to find the specified registry key or value.
md ""
move "abc.md5" ""

Post Reply