• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >DOS/BAT > 批处理生成几乎任何字符,包括Tab

批处理生成几乎任何字符,包括Tab

作者:mdxy-dxy 字体:[增加 减小] 来源:互联网

mdxy-dxy 通过本文主要向大家介绍了tab字符,tab转义字符,一个tab几个字符,html tab字符,c tab字符等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

One of my early posts on DosTips was a :chr routine that could convert a number into the corresponding character. The final code that appears near the end of the thread works really well, and is fast, but nearly all the characters must be embedded in the script. The TAB character in particular can be problematic, especially when trying to post the code on a forum site.

There is the undocumented %=ExitCodeAscii% dynamic variable that converts the most recent error code (from EXIT, not EXIT /B), but it is limited to codes between 32 and 126.

I had never seen a native method to generate a TAB character that works on all Windows versions - until now

I recently ran across this FORFILES documentation gem at SS64.COM:

To include special characters in the command line, use the hex code for the character in 0xHH format (ex. 0x09 is theTAB character, 0x22 is the double quote " character.)
</div>

Eureeka :idea: - The following simple printHex routine can generate any byte code value except 0x00 (nul), 0x0A (newline), and 0x0D (carriage return). 8)

@echo off
setlocal

::Define a Linefeed variable
set LF=^


::above 2 blank lines are critical - do not remove.

::Create a TAB variable
call :hexprint "0x09" TAB

::Print a string with encoded TABs
call :hexprint "A0x09B0x09C"

::Create a string variable with encoded TABs
call :hexprint "A0x09B0x09C" var
set var

exit /b

:hexPrint string [rtnVar]
 for /f eol^=^%LF%%LF%^ delims^= %%A in (
  'forfiles /p "%~dp0." /m "%~nx0" /c "cmd /c echo(%~1"'
 ) do if "%~2" neq "" (set %~2=%%A) else echo(%%A
exit /b
</div>

I'll be playing Native American style flutes at a retreat in the Blue Ridge Mountains of Virginia for the next 4 days :D , without computer access :|
I wanted to post this before I left.

Enjoy the code, while I enjoy the crisp fall air. :)

Dave Benham

</div>

您可能想查找下面的文章:

  • 批处理生成几乎任何字符,包括Tab

相关文章

  • BAT脚本编写教程(比较易懂和全面)
  • 批处理将文件侠内的文件名导入表格对应名称中
  • Windows系统清理QQ聊天记录、反监控QQ聊天的BAT脚本分享
  • cmd rd命令 删除文件夹
  • DOS 强行杀进程的命令
  • DOS命令全集(一)
  • Dos批处理常用命令大全扫盲篇
  • 批处理变量应用方法
  • 利用DOS命令来对抗U盘病毒保护U盘数据
  • 一个命令行(批处理)延迟执行命令的语法

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • 批处理bat递归计算N!的实现代码
    • dos进程查看与停止命令分享(tasklist,taskkill)
    • 批处理的"循环"效果脚本
    • 批处理入门与提高
    • DOS命令常识
    • 安静运行批处理的vbs脚本
    • 用批处理设置IP安全策略的代码
    • DOS未公开命令与参数列表
    • DOS命令全集(二)
    • 服务器应用自动重新启动IIS批处理 原创

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有