Is this a command line that you type at DOS? If so, perhaps you can create a batch file with this code in it.
Click on the "Start" button and select "Run" and type "command". This'll open a DOS shell, regardless of which version of Windows you have.
Change to the drive and folder/sub-directory that has the game and type:
COPY CON CHEAT.BAT
ultima7 ABCD[ALT+255]
Your DOS prompt will disappear after pressing enter on the first line, but that's normal. After typing the second line, press the F6 key, and press enter. Type EXIT to go back to Windows.
Now, run DOSBOX as you normally would, but type CHEAT to start the game instead of ULTIMA7.
Hope that works for ya.