Migrated From JP Software Wiki
Underscore.btm displays all files in a folder in a point-and-shoot menu and for filenames selected it replaces all spaces with underscores.
This is particularly useful when uploading to a Unix/Linux system files created in Windows, because Unix/Linux often automatically replaces spaces in filenames with "%20", in which case links to the uploaded files that still contain spaces in the names may not work.
Programming technique
I tried using select with the @replace function and the rename command but they don't work together. The solution is to use echo to write code for a temporary batch file, have select call the batch file and then delete the batch file. Instead of echo, TEXT -- ENDTEXT can be used to create a large multi-step batch file.
Batch file code
Contributed by Rick Reinckens
Underscore.btm displays all files in a folder in a point-and-shoot menu and for filenames selected it replaces all spaces with underscores.
This is particularly useful when uploading to a Unix/Linux system files created in Windows, because Unix/Linux often automatically replaces spaces in filenames with "%20", in which case links to the uploaded files that still contain spaces in the names may not work.
Programming technique
I tried using select with the @replace function and the rename command but they don't work together. The solution is to use echo to write code for a temporary batch file, have select call the batch file and then delete the batch file. Instead of echo, TEXT -- ENDTEXT can be used to create a large multi-step batch file.
Batch file code
Code:
: underscore.btm
: by Joseph "Rick" Reinckens
:
: Displays all files in a folder in a point-and-shoot menu
: For filenames selected it replaces all spaces with underscores
: FUNCTION underscore %@replace[ ,_,%1]
@echo off
: Create a temporary batch file
echo `rename %1 %@replace[ ,_,%1]`>c:\zztemp.btm
select call c:\zztemp.btm (*.*)
: Delete the temporary file
del c:\zztemp.btm /q
Contributed by Rick Reinckens