Look in data/init/d_init.txt for the PATH_COST setting. If you change this, the new values will be active when you next start DF and all future sessions.
Values are saved in the savegame though, so to change cost in existing fortresses you must do it manually in every each of them.
Are you sure about that? I know the raws are copied in the save directory, but I don't think any of the init settings are. Other changes to that file certainly take effect in the next session, which is trivial to verify for something like the VARIED_GROUND_TILES setting.
Quick test says that's how it works. Not surprising, really: the pathing cost values can be edited in an active game and are saved with the game. The settings in d_init just change the defaults for new games, they don't overwrite the saved values of already-existing regions.
Once again - to change the pathing settings for an active save, you must change the values in the designations menu: d-o -> move "active" highlight to the setting you want to change, qQwW to change pathing cost. This is the only way to change settings in an already-existing fort.
If you want changed values for all future games, go ahead and change the d_init settings; but that only affects worlds (forts?) created after the change.
Making the pathing cost infinite would have the same effect on pathing as placing a wall, door, etc. It would force the computer to search the whole fort before deciding, yep, there's no route there, slowing down calculation to a rather useful end
I don't think so. All numbers in a computer are finite, infinity can only be emulated by infinite loops, division through zero or other errors. I.e. either you have a figuratively infinite (extremely big finite) pathing cost, which would just waste calculation cycles and still path through your blocked area, or you have a truly infinite cost, in which case the program hangs and crashes when trying to calculate a path. You could also get wraparounds or data overflow.
I'd like it if we had a convenient means to specify "forbidden" zones, but i don't think throwing ludicrous values at the current pathing algorithm is the way to do it.