Comparison between by and with:
Both can indicate how someone does something, but in different ways. When you use by, you usually get the result by some behavior, while with gets the result by using some tool or object.
Generally speaking, with can be used as the antonym of by and with at the same time, expressing the opposite meaning. By can also be used for transportation, such as buses and trains. In passive sentences, by is often used to introduce "the person or thing that produces behavior"
Extended data:
With the use
1, with means "comparison" and "parallelism" in comparison.
2.with can be used to express subjunctive mood, meaning "if, if". When used in chorus and refrain of poetry or folk songs, with often has no practical significance.
3. When words such as away and down are added before with, they can be used as command formats without verbs.
4. Adjectives, past participles or nouns followed by objects 4.with can be used as predications.