Which is correct

I’d appreciate it if someone would answer my questions. Thanks in advance.

Which is correct, A or B?

A: How long did it take you to have your TV fixed?

B: How long did it take for you to have your TV fixed?

Which is correct, C or D?

C: How many years have you been learning the language?

D: For how many years have you been learning the language?

Which is correct, E or F?

E: How many years did you spend in having your TV fixed?

F: How long did you spend in having your TV fixed?

Why not give these a go yourself first and indicate which you think are correct?
We’ll then check your answers for you.

–OK I’ll do so.

Which is correct, A or B?

A: How long did it take you to have your TV fixed?

B: How long did it take for you to have your TV fixed?

I think A is OK, but I’m not so sure of B’s being correct.

Which is correct, C or D?

C: How many years have you been learning the language?

D: For how many years have you been learning the language?

I think both are OK, but I’m not so sure.
Which is correct, E or F?

E: How many years did you spend in having your TV fixed?

F: How long did you spend in having your TV fixed?

I think C is correct, but I’m not so sure of F’s being correct.

Please check my self-answer.Thank you.

A/B Both are possible. I suspect the most usual form is B (for you), which more clearly emphasises the fact that he had someone else to repair the TV.
C/D you are right - both are possible.
E/F Neither of them are correct. This is possible:
How long did you spend getting your TV fixed?
but it sounds very odd, because it sounds as if you were spending the time having the TV repaired by someone else.
These are possible but don’t carry quite the same meaning:
How long did it take you to find someone to repair your TV?
How long did it take to have your TV fixed.

--Thank you Beeesnees. I miswrote “How many years” instead of writing “How many hours”
Is “How many hours did you spend getting your TV fixed?” OK? "

Like F, it is acceptable but sounds odd (for the reason already given).

Thank you very much, Beeesneees.