As everyone else has been saying, the only way to gain weight is to eat more. Your change in weight is a simple formula: Calories Eaten minus Calories Burned = Weight Lost/Gained. Whole grains, dairy products, and starches tend to have the highest concentration of both calories and protein, so they're a good bet for most of your meals. Just don't neglect your fruits and veggies.
So if you're not eating more than you were before, you're not going to gain a cent. It's tough on skinny guys, because we have to force food down stomachs that are used to having a smaller amount of food in them. Besides fidgeting, which burns up to 400 calories a day, untrained stomachs are half the reason we're still skinny. You can try eating more often throughout the day, but if you can't remember to eat the snacks you carry around you're going to have to stretch your stomach.
As for building actual muscle, higher weights build mass and higher repetitions build tone. Normally you want to do both, but since you're going to have to gain so much weight you can work on toning yourself later. Load up your weights and work heavily on your upper body, especially your shoulders and arms. That's where you'll see the largest difference.
If your legs are skinny too, do sprints, squats, and work your calves. That'll add a few pounds, just remember that you'll have to eat even more calories if you're working both your upper and lower body. Until your stomach is better trained, you can try alternating upper and lower body workouts. Lower body stuff won't do you much good weight-wise if your legs are well filled, though.
That doesn't mean your cardiovascular system is something you want to ignore before going to Basic, especially if you're throwing on a couple dozen pounds beforehand. Run a few miles at least four times a week, and even better if you've got a dirt trail or hilly area to do it on. It may not help you gain much weight, but you can buy some weight straps you can put on your torso, arms, and legs to turn it into a multi-purpose workout. Endurance is important in Basic, but you'll really have to dig in to your Wheaties in order to keep your caloric intake high enough for weight gain. You may want to start running only after you've trained your gut a bit.
The best way to balance cardio and muscle gain is to exercise two times a day, giving yourself time to recover and take in a few more calories before starting on the next workout. Of course, you could also lift weights two times a day, or just run two times a day, but that's getting outside of the basics.
Also, fair warning: If you're still underweight when you get into Basic it's not a huge deal, but they
will make you eat double rations until your body weight is up to par. It's bad enough that you have to eat yourself sick, but you're also the skinny guy that all the fat dudes hate with a passion because they're stuck with smaller portions. If you don't train your stomach now, they will train it for you.
One final bit of advice: Go Air Force. Seriously.
Eat Anything That Doesn't Eat Me First
This diet has the best acronym ever.
EATDEM First!