Read Mode
Default

How to make Custom Batch File for Search & Replace Files in PC | By Kvc - Requested Batch Script

May 22, 2017
Custom Batch File for Search & Replace Files: In the Begining of - TheBATeam's Journey! We've came across many People. Who wanted to solve their difficulties using the Power of Batch. And, Yasir & Richard are one of those first Followers of TheBATeam - who encouraged us to Go forward. They requested a Custom Batch program / Command. Which can Find a Particular file, that we are looking for in a computer. And, When it finds the file - It'll replace it with our own file - that we desire to put there.
How to make Custom Batch File for Search & Replace Files in PC | By Kvc - Requested Batch Script

So, In a Way - We are trying to learn and Combine multiple Commands of Batch for a single Action. The Concept seems to as us as Fun. And, We started working on the project. One thing, We should mention that - This article is quite Older. But, We are converting all the pages of the blog to articles. Thus, This oldest page came to top at last. So, the scenario of this query is happened long ago. :)
The art and science of asking questions is the source of all knowledge.
Warning: Don't Use this file for any illegal purpose. As, we created it for helping you only for educational purpose. We will not be responsible for any illegal activity done by using this file, only the user will be responsible. Because, If you have the Power to change the world in your hands. Make the Changes for Something good. Not for Personal benefits. :)

The Problem

Custom Batch File for Search & Replace Files in PC

First of all We (#TheBATeam) Wanna say one thing that Yasir got very good skills of asking questions in a well defined way. The way they explained their requirements is very gentle and professional. We really appreciate the way of clarifying everything in proper Way.
While Working on this custom Project, We found a situation where We got confused about the next step of the Algorithm. So We asked them about the action to be taken. If the following kind of condition appears. And, this Time Richard replied and resolved Our confusion. (See the image below)
How to make Custom Batch File for Search & Replace Files in PC | By Kvc - Requested Batch Script
Query Resolved!
Because it is impossible to have two files with same name in one folder. But In a Computer, there are hundreds of folders. And it maybe possible to find different files with same name in different directories (as we are searching it in Whole Computer).


The Project was ready within 2-3 Days and tested on almost all the available Platforms of windows (xp, vista, 7, 8, 8.1, 8.1+, 10 ) and the Project file is working fine. But, Due to Our Busy schedule - We could't deliver the project in time, and We're 2-3 Days Late from Our due time given to the requester.

We heartily apologize for this delay, as life is too complicated. And, We need to take out special time for our hobby. Otherwise, We could also spend our free time in sleeping on the bed. But, this is not - what We've wanted with our life in the end. Thus, we believe in working hard. To achieve something in our life. 

The key is not to priorities what's on your schedule,
but to schedule your priorities
.
--Stephen Covey

How this Program works?

Now The Explaining Part, How this file works?? So, We'll talk about the algorithm & Code of this project. As the way of Asking Question itself explains the Algorithm, We only needed to make a Flexible Batch file, that can either be used as a Batch Command or as A simple Batch File.

i.e. Either you have to simply call this 'mSearch.bat' file from the other batch file / cmd console. or You can directly Run it by Double clicking on it. It all depends on you. That, how you want to use this little utility for your purpose.

Let's Divide the Whole scenario into Two basic cases - like 'On simple Double click Run' and 'Call from cmd console/other batch file'. In this way, It'll be easy to understand the way of using this advance utility.

How to Use it?

Case I: [ Simple Double-click Run ]

When you'll simply double click on this 'mSearch.bat' file. It will run like the following Image. And, You have to simply enter the details in the cmd console. And, your requirement will be fulfilled.

Direct Double Click.

Case II: [ Command like usage / Calling it by other method (cmd/batch file) ]

By this method you can perform all of actions in single go. To see the Help message just change directory to the location where the file 'mSearch' exists.

As a Command Usage in CMD / Batch File
For the command kind of usage. I need to put some extra parameters, in case of certain situations. Thus, you need to have a little look at the Help Menu of the mSearch.bat file. you can simply see it using the traditional -h or /? parameters. Although, using it is quite simpler as it only has few parameters. :)

Help Menu of mSearch

To see the Errorlevel, which indicates the Execution state of the Command. Whether, It is executed successfully or not. You can have different value of the variable Errorlevel, depends on the state of execution. You have to do the following:

Checking for success!
So, In the End - We think that, this file may fulfill their requirement. And, Encourage lot of you to learn and understand more about Batch. You can create your own programs for your own purposes. It's quite easy to do things with batch. But, If you are still in doubt about anything related to this article or program. You can easily make a comment below. And, i'll be happy to help you out. Thanks for your time. :)

Keep Learning, Keep Sharing...
Be Happy, Spread Happiness...

Download Link: mSearch Utility | By Kvc
#TheBATeam


No comments:

Powered by Blogger.