I guess this depends on why exactly you have a smaller window. Is it because you're trying to take advantage of potential returns over a shorter timeframe or your goals are changing in that smaller timeframe (example being going from working to retirement).
If you're looking to take advantage of short term swings, you'll want to target cyclical industries. Think energy, lumber, gold etc. Even particular consumer discretionary stocks can be good options to try and buy and hold through economic cycles to take advantage of market movements.
Alternatively, fixed income does provide additional options for those looking to invest over a shorter time period. Especially with the volatility in interest rates, there is likely some upside in bonds when rates start to normalize and even come down.
That said, it is exceptionally difficult to time these things right. When most investors look to trade in and out of cyclical industries, they tend to buy the top and sell the bottom. This is mostly an emotional element, because generally to succeed at making money over the short to mid term on these cyclical industries, you have to buy the stocks when everyone else hates them, and sell them when everyone else loves them. It is hard for investors to go against the grain like this. Think back to energy stocks in the peak of the pandemic in 2020 for a prime example.