Page 1 of 1

Help with making a command with defined syntax

Posted: 25 Oct 2011 03:28
by Rileyh
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

Re: Help with making a command with defined syntax

Posted: 25 Oct 2011 04:19
by jeb
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

Re: Help with making a command with defined syntax

Posted: 26 Oct 2011 23:15
by Rileyh
@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