您当前的位置: 首页 > 

[原创]利用MASM宏显示环境变量

发布时间:2009-05-28 18:30:00 ,浏览量:0

在windows中如果语言本身提供取得环境变量的方法,我们就不用直接使用win32接口了。那么在masm中可以做到么?答案是肯定的,也十分简单:

@EnvCount macro local i i = 0 % forc char,<@Environ(path)> ifidn, i = i + 1 endif endm exitm endm ShowEnvs macro local index,len index = 1 % repeat @EnvCount() len = @InStr(index,@Environ(path),!;) - index % echo @SubStr(@Environ(path),index,len) index = index + len + 1 endm % echo @SubStr(@Environ(path),index) endm

关注
打赏
1688896170
查看更多评论

暂无认证

  • 0浏览

    0关注

    107766博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0476s