I have a window A/C unit mounted through a hole in the wall. It's bolted in place, so fairly permanent. It has a 6ft power cord with what looks like a GFI on the end. I think the cord is ugly, so I'd like to cut it and hardwire it inside the wall. Are there any safety concerns, and does this violate any codes? I think I would drill a hole in the wall right next to the A/C, send the cord through that and connect to the back of the nearby duplex outlet. I believe the built-in power cord is stranded, so not sure if it's rated for in-wall use.
Flexible cords and cables cannot be used in place of house wiring (NEC 400.8(1)) They also cannot pass through walls (NEC 400.8(2)).
See this answer for more detail.
Cutting the cord also likely voids the UL listing of the product, not to mention the fact that you'll lose GFCI protection.
Hardwiring the unit would also mean you'd have to reevaluate the overcurrent protection, and possibly increase the breaker and conductor size. This could also mean that you'd have to remove other outlets (receptacle, lighting, etc.), to reduce the risk of overloading the circuit.