DOS command to format string to hex value

若如初见. 提交于 2020-01-16 13:19:08

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!