I have a power cord that came with a box of stuff someone gave me. How do I figure out what I can use it with. I tried searching the serial number but nothing specific came up. Can I damage a laptop if I plug it into the wrong laptop?
Instead of serial #, how about a make and model # search?
You wrote "like one of these" but what you pictured, is exactly what I was asking about that you still haven't clarified, because you pictured a power brick with a removable cord. What you have in the picture is not called the power cord, rather is called the AC/DC adapter.
If the plug physically fits in the laptop, then it needs to have the same voltage rating as the original, and equal or higher current capacity. There is a little wiggle room on current capacity, for example if the replacement power adapter were rated 2A lower than the original but the laptop battery wasn't installed, it should be close enough to sufficient power margin.
If the laptop uses a serial link (evidenced by an inner pin on the barrel plug (or the power socket on the laptop) or you can research the specific model of laptop to find out) to communicate and identify the power adapter, the laptop may only run at partial power and/or not charge the battery if the AC/DC adapter isn't the original or an aftermarket or at least purpose built with this communication feature built in.