问题
Is it possible to format a string to a hex value using DOS command? I'm trying to pass a hex value to my program from command line but it takes that complete value a a string and not as hex value?
回答1:
Forget about Peak Oil, what about Peak DOS? It's time to look to the future. And the future is PowerShell.
PS > "{0:x4}" -f ([int]"999") 03e7
回答2:
I'm not sure about a DOS command, but you can use Windows Calculator to do this... Just put it into Scientific Mode (the View menu), then put it into Decimal mode (also the View Menu), then type the number, then put it into Hex Mode (again, in the View menu). It will show you the corresponding Hex value for the decimal number you entered.
回答3:
No it only passes strings. You need to do the conversion to hex from inside your program.
来源:https://stackoverflow.com/questions/2103698/dos-command-to-format-string-to-hex-value