cd /d %~dp0
rem change commandtype to "copy" to "move", to select
rem will not work on files without extensions, or files with non-ascii letters in name
rem copy to dir with files and start it.

set commandtype=move

FOR /F "tokens=*" %%G IN ('dir /b /a-d *.*') DO if not %%G==move_or_copy_all_files_to_dir.bat mkdir "%%~nG" & %commandtype% "%%G" "%%~dG%%~pG%%~nG\%%~nG%%~xG"


pause














rem FOR /F "tokens=*" %%G IN ('dir /b /a-d *.*') DO @echo   %%G-%%~nG  

rem drive-path-name-\-name-ext

rem  %~I         - expands %I removing any surrounding quotes (")
rem  %~fI        - expands %I to a fully qualified path name
rem  %~dI        - expands %I to a drive letter only
rem  %~pI        - expands %I to a path only
rem  %~nI        - expands %I to a file name only
rem  %~xI        - expands %I to a file extension only
rem  %~sI        - expanded path contains short names only
rem  %~aI        - expands %I to file attributes of file
rem  %~tI        - expands %I to date/time of file
rem  %~zI        - expands %I to size of file
rem  %~$PATH:I   - searches the directories listed in the PATH