If you want to do it via commandline, use FFmpeg (free, open-source, cross-platform).
First, extract the soundtrack from the correct video file. I assume the audio is MP3*.
ffmpeg -i correct.avi correct.mp3
Then, merge the broken file's video bitstream with the new soundtrack:
ffmpeg -i broken.avi -i correct.mp3 -map 0:0 -map 1:0 -c:v copy -c:a copy out.avi
This will not re-encode the video and audio bitstreams.
* You can verify this by doing a simple
ffmpeg -i correct.avi call and looking for the audio stream. Or, you can use MediaInfo. Note that the extension (here,
.mp3) should really match the audio. If your AVI file does not have MP3 audio, but something else, you have to change the container accordingly.