Help with making a command with defined syntax

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Rileyh
Posts: 147
Joined: 01 Sep 2011 03:54
Location: Perth, Western Australia

Help with making a command with defined syntax

#1 Post by Rileyh » 25 Oct 2011 03:28

Hi all,
Here is what I want to do: (an attempt at a good explanation :) )
1. The user previously types "substart" which allows for the "substitute" command to be run.
2. The user opens cmd and types: substitute + "(string they want to find)" + "(string they want to replace the found string with)" "(file path of the file that contains the string to substitute)". In short, substitute "string1" "string2" "filepath"
3. The command needs to change directory to the given file path, then locate the string in the text/batch file and "comment out"/REM the line.
4. The command then types the "string2"/user defined string into the selected text/batch file on the line after the "string1".
5. The line remains REMed until the user types "subend", which will return the line to it's previous state.

Hopefully there is a solution to my problem.


Regards,
Rileyh

jeb
Expert
Posts: 1058
Joined: 30 Aug 2007 08:05
Location: Germany, Bochum

Re: Help with making a command with defined syntax

#2 Post by jeb » 25 Oct 2011 04:19

Hi Rileyh,

the best way to get the desired batch is to start programming it :wink:

And then if you got problems you can ask, how to solve them.

You could start with a copy of the sample from dostips and then modify it to your vision.

jeb

Rileyh
Posts: 147
Joined: 01 Sep 2011 03:54
Location: Perth, Western Australia

Re: Help with making a command with defined syntax

#3 Post by Rileyh » 26 Oct 2011 23:15

@jeb,
I have previously tried to make this batch and it hasn't worked. I don't have the knowledge to code this sort of thing (yet :wink: )
Could you post a solution (code) for my problem, or else could you post examples/links to help on the forum, please?

Thank you in advance,
Rileyh

Post Reply