Batch File Rename - Batch File needs to move from folder to folder - batch-file

New to batch file writing. We are unable to install a file renamer program at work so i am looking to find a way to create a batch file to do the job instead. I want to create a batch file that i can place in a folder and it will rename all files in that folder with a prefix, while deleting some text from the file name itself. I am happy to edit the prefix text (as it changes all the time) in Notepad each time but I need to be able to move the batch file to the different folders.
The files will be something like this RDS_117856.pdf
and they need to read as xxx-xxx-xxx-117856.pdf
Any help would be great.
I am using windows, only have access to Notepad and no other coding software so a .BAT file would be the easiest thing to create here.

Related

Open a .bat file, out of a folder, off a flashdrive

I have a game that I'm making off of my flashdrive, and I'm trying to make a save feature into an RPG game. I know I can just save all the data into a character bat file, and then call that bat file, but the problem is that my flashdrive looks cluttered whenever multiple characters get formed. understand? I need to beable to load a save, from a character folder (for organization) from a changing source folder, (Because the flashdrive will be in different USB ports, such as :E or :F etc.)
You can determine the drive that a Windows batch file uses by using the CMD variable substitutions. Within a batch file, you can determine where the file resides.
%~d0 is the drive. %~dp0 is the directory. And there are more.
See What does %~dp0 mean, and how does it work?

I want to create .exe file to create multiple folder at a same time

I want to create .exe setup or batch file to create Multiple folders at same time.
and folder name prompt to give or take from .txt file.
If you are ok to enter the name of the folder each time, you can simply use the md command of the Windows Command Line!
Syntax: md MyFolderName
Your question is Operating system dependent.
To create an executable
In windows you can use Visual Studio console application to create a c++ code and build it to obtain a .exe file. You have to take care on the linking options.
To create a directory simply do mkdir("foldername") and to read or write from txt file, create a file stream and use getline to read the names of folder.
In linux I suppose it can be done by writing a bash script.

pass execution path of sfx to batch file

So basically i want to wrap my batch file in an sfx to make a tidy package as I am using multiple files that need to be packaged with the batch file. The problem I am facing is that I need drag and drop functionality so I need to somehow pass the file dropped on the sfxz to the batch file via the execution code.
I am using the winrar default sfx module.
So far I have tried passing it with the %~1 variable but that just passes literally %~1 instead of the location of the dropped file
Any help will be appreciated.
You can use BHX from here to encode the binaries into the batch file, so it is just one file to distribute. http://www.dostips.com/forum/viewtopic.php?f=3&t=4104

Create a batch file to update an exe file over FTP

I need to update an exe file on a daily basis, did create a batch file and used the 'fc' command which worked like a charm but i have two issues.
1) The newer version of the exe file would be located on an FTP site
2) The location of the older exe file would not be fixed.
The older exe file is a single executable and the problem is the user can save it anywhere, need a command so that i can locate that file compare it with the file on the FTP site and update that file if needed.
I am new to this, any help is greatly appreciated.
well you can avoid all of this by using a briefcase then put the file that you want to update into the briefcase and then run the update manually.
but if you really want to do it with a batch file then
#echo off
cls
replace (file being updated) (updated file)
exit

batch script to find a particular folder in a drive

am a newbie to the batch script, i have many folders called LIB in my drive
say it can be as LIB_data,lib,lib_ac anything that starts with lib or LIB... i want to list all these directories and sort them in which they have created in the pc and copy the latest directory contents to BATCH_LATEST_LIB_FILES folder,that will be a new folder created by this batch file.i want this new folder to be created in the path where this batch file is present. please help me with a batch script.
You might look at FOR, DATE, TIME, SORT, IF, GOTO and XCOPY.
This site is a great resource for batch files.

Resources