Showing posts with label scripting language - bat file. Show all posts
Showing posts with label scripting language - bat file. Show all posts

Wednesday, September 23, 2020

Duplicate Open Current Folder in a New Window

Sometimes after I opened a folder in Win7, I would like to duplicate open the same folder again in another explorer window. Then, I can operated these 2 windows side by side. How to open current folder AGAIN? Sometimes, when you use a Save As operation in some application, the application popup a window with a DEFAULT folder. Could you open this DEFAULT folder in a new explorer window for you to use later? Here is the trick.

First of all, using notepad or else to create a file named open_this_folder.cmd with the following lines:

@echo off

set CURRENTDRIVE=%~d1%
set CURRENTDIR=%~p1%
c:\windows\explorer.exe /root,"%CURRENTDRIVE%%CURRENTDIR%"

Put this file in any folder (e.g. C:\Bat)

Then go to the send-to folder using this method:
  1. press Win+E to open an explorer window
  2. press Alt+D to go to address bar
  3. input shell:sendto
  4. press ENTER
In the send-to folder, using drag-and-drop to create a shortcut to point to the open_this_folder.cmd file in C:\Bat.

Now, everything is done!

Here is the detail steps to demo this trick:
  1. Go to the any folder (e.g. C:\Users)
  2. Select randomly any file or sub-folder (e.g. All Users)
  3. Right-click the mouse button
  4. In the pop-up menu, select Send to
  5. Wait for another pop-up menu and select the shortcut for open_this_folder.cmd
Then, another NEW explorer window will be opened for the current folder C:\Users. Now, there are 2 windows for the folder C:\Users on the desktop.

You can also use this trick duing a Save-As dialogue to open the current Save-As DEFAULT folder in a new explorer window. Then, after saving, you can operate the folder at once.
Alvin SIU
2020-09-23
Copyright/Licence Information:
All information and coding in this article is offered at no charge for NON-COMMERCIAL PERSONAL USE only.
This blog and the coding is copyright.
Reproduction of this blog and its coding in whole or in part in paper or digitally or in any other forms without the explicit written permission of the author is strictly prohibited.

Disclaimer:
All information in this article is distributed "as is" and is UNSUPPORTED.
NO WARRANTY of any kind is expressed or implied.
You use AT YOUR OWN RISK.
The author will not be liable for any data loss, damages, and loss of profits or any other kind of tangible or intangible loss while using or misusing wholly or partly of the information.

Thursday, July 2, 2020

Using VLC to randomly play media files in some selected folders

Have you ever want to randomly play songs or MTV in some selected folders in Win7 ? For example, all the the mp3 or mp4 files are organized this way:
C:\MyAlbum\Artist1
C:\MyAlbum\Artist2
C:\MyAlbum\Artist3
C:\MyAlbum\Artist4
C:\MyAlbum\Artist5
C:\MyAlbum\Artist6
C:\MyAlbum\Artist7

I just want to play the media files for Artist1, Artist3 and Artist7 only. What can I do?

Here is the method.

First of all, using notepad or else to create a file named play_randomly_with_VLC.cmd with the following 2 lines:

@echo off

start "" "C:\Program Files\VideoLAN\VLC\vlc.exe" --random --zoom=1 --volume=256 %1 %2 %3 %4 %5 %6 %7 %8 %9

Put this file in any folder (e.g. C:\Bat)
Then go to the send-to folder using this method:
  1. press Win+E to open an explorer window
  2. press Alt+D to go to address bar
  3. input shell:sendto
  4. press ENTER

In the send-to folder, using drag-and-drop to create a shortcut to point to the play_randomly_with_VLC.cmd file in C:\Bat.
Now, everything is done!
Here is how to call VLC to play the media files for Artist1, 3 and 7:
  1. Go to the folder C:\MyAlbum
  2. Select the folders Artist1, Artist3 and Artist7 using the Ctrl key and the mouse left-button
  3. Release the Ctrl key and Right-click the mouse button
  4. In the pop-up menu, select Send to
  5. Wait for another pop-up menu and select the shortcut for play_randomly_with_VLC.cmd

Then, VLC will be called to randomly play all mp3 or mp4 files inside the folders Artist1, Artist3 and Artist7.

This method can at most select 9 folders
Alvin SIU
2020-07-02
Copyright/Licence Information:
All information and coding in this article is offered at no charge for NON-COMMERCIAL PERSONAL USE only.
This blog and the coding is copyright.
Reproduction of this blog and its coding in whole or in part in paper or digitally or in any other forms without the explicit written permission of the author is strictly prohibited.

Disclaimer:
All information in this article is distributed "as is" and is UNSUPPORTED.
NO WARRANTY of any kind is expressed or implied.
You use AT YOUR OWN RISK.
The author will not be liable for any data loss, damages, and loss of profits or any other kind of tangible or intangible loss while using or misusing wholly or partly of the information.

Use VLC to randomly play ALL media files inside a folder

Have you ever wonder to put all the media files (e.g. mp3 songs or MTV in mp4 format) in a folder as an album and then let VLC to play them one by one randomly?

Under Win7, here is the simple way.

Assuming that VLC is installed in the folder "C:\Program Files\VideoLAN\VLC", then:
  1. Put all your favourite mp3 or mp4 files inside a folder named, for example, C:\MySongs
  2. In your Win7 desktop, create a short cut ...
  3. In the location:
    "C:\Program Files\VideoLAN\VLC\vlc.exe" --random --zoom=1  --volume=256 "C:\MySongs"
  4. Click the Next button
  5. Then, input the following as the name of the shortcut:
    VLC Play Randomly
  6. Click the Finish button
It is all done!

Now, just double-click this shortcut will call-up VLC to randomly play all files inside this folder.   You can even create sub-folders to organize your songs.

Alvin SIU
2020-07-02

Copyright/Licence Information:
All information and coding in this article is offered at no charge for NON-COMMERCIAL PERSONAL USE only.
This blog and the coding is copyright.
Reproduction of this blog and its coding in whole or in part in paper or digitally or in any other forms without the explicit written permission of the author is strictly prohibited.

Disclaimer:
All information in this article is distributed "as is" and is UNSUPPORTED.
NO WARRANTY of any kind is expressed or implied.
You use AT YOUR OWN RISK.
The author will not be liable for any data loss, damages, and loss of profits or any other kind of tangible or intangible loss while using or misusing wholly or partly of the information.

Tuesday, December 16, 2008

Mould / Copy A Directory Tree Structure in Windows

In Windows, it is eay to copy / duplicate the entire directory tree by simply right click the mouse. But, how to mould / copy only the directory tree structure ? This batch file is the answer.

The following batch file named tree_mould.bat can mould / copy the directory tree structure without copying the files inside. It can be used in the command line mode or inside the GUI explorer (by using the Send To).

The batch file will by default mould / copy the directory tree structure to a new directory name with the current date as suffix. So, your PC has to pre-set the short date format as YYYY-MM-DD in order for this batch file proper functioning.

Here is the batch file tree_mould.bat

@echo off
:: ------------------------------------------------------
:: Licence Information:
:: --------------------
:: This coding is offered at no charge for 
:: NON-COMMERCIAL PERSONAL USE only.
:: The coding is copyright.
:: Reproduction of this coding in whole or in part 
:: in any form without the express written permission 
:: of the author is strictly prohibited. 
:: ------------------------------------------------------
:: Disclaimer:
:: -----------
:: This coding is distributed "as is" and is UNSUPPORTED.
:: NO WARRANTY of any kind is expressed or implied.
:: You use AT YOUR OWN RISK.
:: The author will not be liable for any data loss,
:: damages, and loss of profits or any other kind of
:: tangible or intangible loss while using or 
:: misusing this coding.
:: ------------------------------------------------------
:: Name    : tree_mould.bat
:: Purpose : Mould the directory tree using the xcopy command
::           with today as the suffix of the new tree
:: Platform: DOS, Win XP
:: Author  : Alvin SIU
:: Date    : 2007-12-16
:: ------------------------------------------------------
:: Attentions:
:: -----------
:: 1. It is highly recommended to set the SHORT date format
::    of your PC to be YYYY-MM-DD
:: 2. If your short date format uses slash (i.e. /) as 
::    separator, this batch file cannot function properly.
:: ------------------------------------------------------
:: Command Line Usage Example: 
::           tree_mould  A_Directory
:: This will mould the directory tree structure of 
:: A_Directory to A_Directory.d2007-12-16
:: provided that today is 2007-12-16 and the date /t command
:: in your PC will display 2007-12-16
:: ------------------------------------------------------
:: GUI Installation:
::   1. Put this file tree_mould.bat into any directory
::   2. Go to your Send To folder 
::   3. Create a shortcut tree_mould.bat to point to this file
:: GUI Usage Example:
::   1. Highlight any one directory, e.g. A_Directory
::   2. Right click mouse
::   3. Select Send To
::   4. Select the shortcut tree_mould.bat
::   This will mould the directory tree structure of 
::   A_Directory to A_Directory.d2007-12-16
::   provided that today is 2007-12-16 and the date command
::   in your PC will display 2007-12-16
:: ------------------------------------------------------

set TMP_TREE_MOULD_NEW_DIR=%1.d%DATE%

echo tree_mould 
echo from tree : %1 
echo to   tree : %TMP_TREE_MOULD_NEW_DIR%
echo.

if not exist %1 goto NOT_EXIST

if not exist %1\NUL goto NOT_DIR

if exist %TMP_TREE_MOULD_NEW_DIR% goto JUST_EXIST

mkdir %TMP_TREE_MOULD_NEW_DIR%
if errorlevel 1 goto MD_ERR

xcopy /f /t /e %1 %TMP_TREE_MOULD_NEW_DIR%
if errorlevel 1 goto XCOPY_ERR

echo OK, directory tree structure is moulded
goto QUITING

:NOT_EXIST
echo ERROR: There is no such directory %1
goto QUITING

:NOT_DIR
echo ERROR: The item %1
echo ERROR: is NOT a directory
goto QUITING

:JUST_EXIST
echo ERROR: Target directory %TMP_TREE_MOULD_NEW_DIR%
echo ERROR: already exist
goto QUITING

:MD_ERR
echo Error: Cannot Create NEW directory %TMP_TREE_MOULD_NEW_DIR%
goto QUITING

:XCOPY_ERR
echo ERROR: xcopy returns error
goto QUITING

:QUITING
set TMP_TREE_MOULD_NEW_DIR=
echo.
echo.
pause

:: ------------------------------------------------------
:: End Of File tree_mould.bat
:: ------------------------------------------------------

The detail installation and usage instruction are at the beginning of the file.

Alvin SIU
2008-12-16

Copyright/Licence Information:
All information and coding in this article is offered at no charge for NON-COMMERCIAL PERSONAL USE only.
This blog and the coding is copyright.
Reproduction of this blog and its coding in whole or in part in paper or digitally or in any other forms without the explicit written permission of the author is strictly prohibited.

Disclaimer:
All information in this article is distributed "as is" and is UNSUPPORTED.
NO WARRANTY of any kind is expressed or implied.
You use AT YOUR OWN RISK.
The author will not be liable for any data loss, damages, and loss of profits or any other kind of tangible or intangible loss while using or misusing wholly or partly of the information.

Duplicate Open Current Folder in a New Window

Sometimes after I opened a folder in Win7, I would like to duplicate open the same folder again in another explorer window. Then, I can ope...