batch input to organize
Moderator: DosItHelp
Re: batch input to organize
Hi foxidrive, with this command "cd /d "%drive%\ORGANIZED"
nope! it didn´t change to the organized folder. Maybe I didn´t explain myself.
When the program run the last routine,
if not exist %drive%\ORGANIZED\INTERNET-FILES md %drive%\ORGANIZED\INTERNET-FILES
for %%x in (htm html) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\INTERNET-FILES
I want it to open the folder called ORGANIZED and I will take off this comment at the end:
ECHO ..................................................................................................
ECHO REMEMBER, LOOK FOR FOLDER "ORGANIZED" IN THE DRIVE YOU SELECTED
ECHO ..................................................................................................
nope! it didn´t change to the organized folder. Maybe I didn´t explain myself.
When the program run the last routine,
if not exist %drive%\ORGANIZED\INTERNET-FILES md %drive%\ORGANIZED\INTERNET-FILES
for %%x in (htm html) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\INTERNET-FILES
I want it to open the folder called ORGANIZED and I will take off this comment at the end:
ECHO ..................................................................................................
ECHO REMEMBER, LOOK FOR FOLDER "ORGANIZED" IN THE DRIVE YOU SELECTED
ECHO ..................................................................................................
Re: batch input to organize
Try this. Tell me what it prints to the console.
Code: Select all
cd /d "%drive%\ORGANIZED"
echo %cd%
pause
Re: batch input to organize
It printed:
C:\ORGANIZED
press any key to continue...
Does not change to that directory!
C:\ORGANIZED
press any key to continue...
Does not change to that directory!
Re: batch input to organize
blackpete wrote:It printed:
C:\ORGANIZED
press any key to continue...
Does not change to that directory!
How can you say that. It just echoed the current working directory to your screen. Proof is in the pudding.
Re: batch input to organize
Yes Squashman, it did echoed, but only to the CMD screen. but it didn´t actually open a windows showing the contents of the ORGANIZED folder.
Re: batch input to organize
Ahh, *thats* what you want.
Try this:
Mind you, with the cd /d syntax it will then close your batch file and leave you in the organized folder.
so this will work as the last lines too:
But what I think you want is this: a windows folder view.
Try this:
Code: Select all
start "" "%comspec%" /k dir "%drive%\organized"
Mind you, with the cd /d syntax it will then close your batch file and leave you in the organized folder.
so this will work as the last lines too:
Code: Select all
cd /d "%drive%\ORGANIZED"
dir
But what I think you want is this: a windows folder view.
Code: Select all
explorer "%drive%\ORGANIZED"
Re: batch input to organize
Yes, that is what I was looking for.
See the other commands would show a directory inside a CMD screen:
start "" "%comspec%" /k dir "%drive%\organized"
cd /d "%drive%\ORGANIZED"
dir
But now, with this :
explorer "%drive%\ORGANIZED"
it shows the finish job.
Good foxdrive! moving along......
See the other commands would show a directory inside a CMD screen:
start "" "%comspec%" /k dir "%drive%\organized"
cd /d "%drive%\ORGANIZED"
dir
But now, with this :
explorer "%drive%\ORGANIZED"
it shows the finish job.
Good foxdrive! moving along......
Re: batch input to organize
So this is the English version:
Code:
@echo off
cls
:MENU
ECHO.
ECHO .....................................................................
ECHO THIS PROGRAM WILL ORGANIZE YOUR SCATTERED FILES INTO SEPARATE FOLDERS
ECHO .....................................................................
ECHO.
ECHO C: - 1
ECHO D: - 2
ECHO E: - 3
ECHO F: - 4
ECHO G: - 5
ECHO H: - 6
ECHO I: - 7
ECHO EXIT - 8
ECHO.
set drive=
set /p drive= WHICH DRIVE DO YOU WANT TO ORGANIZE FIRST?
ECHO ---------------------------------------
if "%drive%"=="1" (set "drive=C:"
)else if "%drive%"=="2" (set "drive=D:"
)else if "%drive%"=="3" (set "drive=E:"
)else if "%drive%"=="4" (set "drive=F:"
)else if "%drive%"=="5" (set "drive=G:"
)else if "%drive%"=="6" (set "drive=H:"
)else if "%drive%"=="7" (set "drive=I:"
)else if "%drive%"=="8" (goto :eof
) else goto :menu
if not exist %drive%\ORGANIZED\DOCUMENTS md %drive%\ORGANIZED\DOCUMENTS
for %%x in (doc txt docx pdf rtf vsd wpd wri) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\DOCUMENTS
if not exist %drive%\ORGANIZED\PHOTOS md %drive%\ORGANIZED\PHOTOS
for %%x in (bmp gif jpg jpeg png tiff psd psp wmf) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\PHOTOS
if not exist %drive%\ORGANIZED\MUSIC md %drive%\ORGANIZED\MUSIC
for %%x in (mp3 wav wma mid m4a au ape) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\MUSIC
if not exist %drive%\ORGANIZED\POWERPOINT md %drive%\ORGANIZED\POWERPOINT
for %%x in (ppt pptx) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\POWERPOINT
if not exist %drive%\ORGANIZED\EXCEL md %drive%\ORGANIZED\EXCEL
for %%x in (xls xlsx) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\EXCEL
if not exist %drive%\ORGANIZED\VIDEO md %drive%\ORGANIZED\VIDEO
for %%x in (wmv avi mov flv m4v rmvb mpeg) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\VIDEO
if not exist %drive%\ORGANIZED\COMPRESS-FILES md %drive%\ORGANIZED\COMPRESS-FILES
for %%x in (zip rar ace 7z gz) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\COMPRESS-FILES
if not exist %drive%\ORGANIZED\INTERNET-FILES md %drive%\ORGANIZED\INTERNET-FILES
for %%x in (htm html) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\INTERNET-FILES
ECHO.
ECHO ----------------------------------------------------------------
ECHO JOB IS DONE---PRESS ANY KEY AND CHECK
ECHO ----------------------------------------------------------------
pause>nul
explorer "%drive%\ORGANIZED"
Code:
@echo off
cls
:MENU
ECHO.
ECHO .....................................................................
ECHO THIS PROGRAM WILL ORGANIZE YOUR SCATTERED FILES INTO SEPARATE FOLDERS
ECHO .....................................................................
ECHO.
ECHO C: - 1
ECHO D: - 2
ECHO E: - 3
ECHO F: - 4
ECHO G: - 5
ECHO H: - 6
ECHO I: - 7
ECHO EXIT - 8
ECHO.
set drive=
set /p drive= WHICH DRIVE DO YOU WANT TO ORGANIZE FIRST?
ECHO ---------------------------------------
if "%drive%"=="1" (set "drive=C:"
)else if "%drive%"=="2" (set "drive=D:"
)else if "%drive%"=="3" (set "drive=E:"
)else if "%drive%"=="4" (set "drive=F:"
)else if "%drive%"=="5" (set "drive=G:"
)else if "%drive%"=="6" (set "drive=H:"
)else if "%drive%"=="7" (set "drive=I:"
)else if "%drive%"=="8" (goto :eof
) else goto :menu
if not exist %drive%\ORGANIZED\DOCUMENTS md %drive%\ORGANIZED\DOCUMENTS
for %%x in (doc txt docx pdf rtf vsd wpd wri) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\DOCUMENTS
if not exist %drive%\ORGANIZED\PHOTOS md %drive%\ORGANIZED\PHOTOS
for %%x in (bmp gif jpg jpeg png tiff psd psp wmf) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\PHOTOS
if not exist %drive%\ORGANIZED\MUSIC md %drive%\ORGANIZED\MUSIC
for %%x in (mp3 wav wma mid m4a au ape) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\MUSIC
if not exist %drive%\ORGANIZED\POWERPOINT md %drive%\ORGANIZED\POWERPOINT
for %%x in (ppt pptx) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\POWERPOINT
if not exist %drive%\ORGANIZED\EXCEL md %drive%\ORGANIZED\EXCEL
for %%x in (xls xlsx) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\EXCEL
if not exist %drive%\ORGANIZED\VIDEO md %drive%\ORGANIZED\VIDEO
for %%x in (wmv avi mov flv m4v rmvb mpeg) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\VIDEO
if not exist %drive%\ORGANIZED\COMPRESS-FILES md %drive%\ORGANIZED\COMPRESS-FILES
for %%x in (zip rar ace 7z gz) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\COMPRESS-FILES
if not exist %drive%\ORGANIZED\INTERNET-FILES md %drive%\ORGANIZED\INTERNET-FILES
for %%x in (htm html) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZED\INTERNET-FILES
ECHO.
ECHO ----------------------------------------------------------------
ECHO JOB IS DONE---PRESS ANY KEY AND CHECK
ECHO ----------------------------------------------------------------
pause>nul
explorer "%drive%\ORGANIZED"
Last edited by blackpete on 03 Aug 2012 20:26, edited 1 time in total.
Re: batch input to organize
Code: Select all
start .
That's a period after the start command.
Re: batch input to organize
Squashman, That's a period after the start command.
What start command?
What start command?
Re: batch input to organize
This is the Spanish version:
edited by Squashman to put CODE tags around the code
edited by Squashman to put CODE tags around the code
Code: Select all
@echo off
cls
:MENU
ECHO.
ECHO .....................................................................
ECHO ESTE PROGRAMA ORGANIZA SUS ARCHIVOS QUE ESTAN DESORDENADOS
ECHO .....................................................................
ECHO.
ECHO C: - 1
ECHO D: - 2
ECHO E: - 3
ECHO F: - 4
ECHO G: - 5
ECHO H: - 6
ECHO I: - 7
ECHO SALIR - 8
ECHO.
set drive=
set /p drive= CUAL DISCO QUIERE ORGANIZAR PRIMERO?
ECHO ---------------------------------------
if "%drive%"=="1" (set "drive=C:"
)else if "%drive%"=="2" (set "drive=D:"
)else if "%drive%"=="3" (set "drive=E:"
)else if "%drive%"=="4" (set "drive=F:"
)else if "%drive%"=="5" (set "drive=G:"
)else if "%drive%"=="6" (set "drive=H:"
)else if "%drive%"=="7" (set "drive=I:"
)else if "%drive%"=="8" (goto :eof
) else goto :menu
if not exist %drive%\ORGANIZADO\DOCUMENTOS md %drive%\ORGANIZADO\DOCUMENTOS
for %%x in (doc txt docx pdf rtf vsd wpd wri) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZADO\DOCUMENTOS
if not exist %drive%\ORGANIZED\PHOTOS md %drive%\ORGANIZADO\FOTOS
for %%x in (bmp gif jpg jpeg png tiff psd psp wmf) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZADO\FOTOS
if not exist %drive%\ORGANIZADO\MUSICA md %drive%\ORGANIZADO\MUSICA
for %%x in (mp3 wav wma mid m4a au ape) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZADO\MUSICA
if not exist %drive%\ORGANIZADO\POWERPOINT md %drive%\ORGANIZADO\POWERPOINT
for %%x in (ppt pptx) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZADO\POWERPOINT
if not exist %drive%\ORGANIZADO\EXCEL md %drive%\ORGANIZADO\EXCEL
for %%x in (xls xlsx) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZADO\EXCEL
if not exist %drive%\ORGANIZADO\VIDEO md %drive%\ORGANIZADO\VIDEO
for %%x in (wmv avi mov flv m4v rmvb mpeg) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZADO\VIDEO
if not exist %drive%\ORGANIZADO\ARCHIVOS-COMPRIMIDOS md %drive%\ORGANIZADO\ARCHIVOS-COMPRIMIDOS
for %%x in (zip rar ace 7z gz) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZADO\ARCHIVOS-COMPRIMIDOS
if not exist %drive%\ORGANIZADO\ARCHIVOS-INTERNET md %drive%\ORGANIZADO\ARCHIVOS-INTERNET
for %%x in (htm html) do move >nul 2>nul /-y %drive%\*.%%x %drive%\ORGANIZADO\ARCHIVOS-INTERNET
ECHO.
ECHO ----------------------------------------------------------------
ECHO TRABAJO TERMINADO---PRESIONE UNA TECLA PARA REVISAR
ECHO ----------------------------------------------------------------
pause>nul
explorer "%drive%\ORGANIZADO"
Re: batch input to organize
blackpete wrote:Squashman, That's a period after the start command.
What start command?
The START command like Foxidrive was showing you in his previous code. There is a command called START.
When you see someone put something in CODE tags on the forums that means it is code you can run in a batch file.
In a batch file or even at the command prompt type:
Code: Select all
start .
See what it does!
Re: batch input to organize
blackpete, your code will 'organise' the directory that the batch file is launched in, not just the root folder.
That has the potential for unintended consequences, unless the user is made aware of it.
That has the potential for unintended consequences, unless the user is made aware of it.
Re: batch input to organize
Squashman wrote:In a batch file or even at the command prompt type:Code: Select all
start .
See what it does!
That could be useful. I hadn't thought to try that before.
Re: batch input to organize
foxidrive, if I typed (start.) with a dot, at the command prompt, it gives me a windows folder view of where I am.
So if I am at C:\ it will show all the folder in there.
Now, if I typed only (start) without the dot, will open another CMD windows.
To clarify something foxidrive, I don´t know if your quote is a question or a statement.
"blackpete, your code will 'organise' the directory that the batch file is launched in, not just the root folder.
That has the potential for unintended consequences, unless the user is made aware of it."
but, I can tell you that I have being testing the batch in this manner:
Batch file located in the desktop, double click, choose the drive, per example C: and it creates in C: a folder called organized with all the sub-folders, and moves all the scattered files in the desktop to the different sub-folders.
I have also tried it in my partition D:, always called from the desktop in C:
And one last thing, I just copied the batch to D: and launch it from there to organize C: and did the job in the same way.
Do you need more proof?
So if I am at C:\ it will show all the folder in there.
Now, if I typed only (start) without the dot, will open another CMD windows.
To clarify something foxidrive, I don´t know if your quote is a question or a statement.
"blackpete, your code will 'organise' the directory that the batch file is launched in, not just the root folder.
That has the potential for unintended consequences, unless the user is made aware of it."
but, I can tell you that I have being testing the batch in this manner:
Batch file located in the desktop, double click, choose the drive, per example C: and it creates in C: a folder called organized with all the sub-folders, and moves all the scattered files in the desktop to the different sub-folders.
I have also tried it in my partition D:, always called from the desktop in C:
And one last thing, I just copied the batch to D: and launch it from there to organize C: and did the job in the same way.
Do you need more proof?