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

批处理制作二维码生成器

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

hebedich 通过本文主要向大家介绍了二维码生成器在线制作,制作二维码生成器,如何制作二维码生成器,制作二维码生成器下载,二维码生成器怎么制作等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

这个程序不能直接支持 Unicode, 同样不能直接支持任何双字节或多字节字符(包括汉字), 但可以用十六进制转码的方式生成包含 Unicode (或其他任何编码)字符的二维码图形.

如果数据含有UTF-8 Unicode 字符时, 在数据头部加上 BOM (\xEF\xBB\xBF) 即可.

例如:
\xEF\xBB\xBF\xE6\xB1\x89\xE5\xAD\x97
上面的代码表示中文字符 "汉字"

任何 ASCII 字符(\x00 到 \xFF)都可以用十六进制转码方式输入, 也可以用明文输入(如果可以的话), 十六进制转码用 "\x" 开头, 后跟两位十六进制.
例如: \x20 表示空格

纠错等级有4级可选: L,M,Q,H

掩码图形有 8 种可选: 0 到 7 的整数.

已更正的问题: 版本20141113, 当数据中含有双引号时, 有可能导致程序退出.

测试于 Win7 64 位 及 XP 32 位

REM If you want to rewrite the registry to automatically set the console font size to 8X8 pixels, please un-remark the next line.
REM %1 @goto :initCON
@echo off & chcp 437 & mode 200, 200
echo;
echo; QRCODE.CMD
echo;
echo; Author neorobin -- Rewritten in CMD Batch @ Nov. 12, 2014
echo;
echo; Author davidshimjs -- QRCode for Javascript library
echo; See http://www.d-project.com/
echo; See http://jeromeetienne.github.com/jquery-qrcode/
echo;
echo; ---------------------------------------------------------------------
echo; QRCode for JavaScript
echo;
echo; Copyright (c) 2009 Kazuhiko Arase
echo;
echo; URL: http://www.d-project.com/
echo;
echo; Licensed under the MIT license:
echo; http://www.opensource.org/licenses/mit-license.php
echo;
echo; The word "QR Code" is registered trademark of
echo; DENSO WAVE INCORPORATED
echo; http://www.denso-wave.com/qrcode/faqpatent-e.html
echo;
echo; ---------------------------------------------------------------------
echo;
REM ************************************************************
REM *
REM *            Main Program
REM *
REM ************************************************************
REM If you want to clear some environment variables to speed up running, you can un-remark the next line.
call :clearVars
setlocal enabledelayedexpansion
call :initGlobalVars
call :quickShow
:main.loop
 REM If the data contains Unicode UTF-8 characters, you must add the BOM data header (\xEF\xBB\xBF).
 REM set "BOM=\xEF\xBB\xBF"
 echo;
 set /p "data=Input data:"
 if "!data!"=="" goto :main.loop
 set "errorCorrectLevel="
 set /p "t=Choose a error correct level (L/M/Q/H):"
 for %%a in (L:1 M:0 Q:3 H:2) do for /f "tokens=1,2 delims=:" %%v in ("%%a") do if /i "%t%"=="%%v" set "errorCorrectLevel=%%w"
 if "%errorCorrectLevel%"=="" set "errorCorrectLevel=1"
 REM A - Auto, [0..7] - spec, else random
 set /p "mp=Choose a mask pattern between 0 and 7 :"
 if /i "!mp!"=="A" (
  set "maskPattern="
 ) else if "!mp!" geq "0" (
  if "!mp!" leq "7" (
   set /a "maskPattern = !mp:~0,1!"
  ) else (
   set "mp=r"
  )
 ) else (
  set "mp=r"
 )
 if "!mp!"=="r" (
  set /a "maskPattern = !random! & 7"
 )
 call :QRCode.makeCode data errorCorrectLevel maskPattern
goto :main.loop
exit
REM ************************************************************
REM *
REM *            Functions
REM *
REM ************************************************************
:QRCode.makeCode data errorCorrectLevel maskPattern
setlocal enabledelayedexpansion
 echo; & echo;QRCode.makeCode & echo;
 set "data=!%~1!"
 set /a "errorCorrectLevel = %~2"
 set "maskPattern=!%~3!"
 set data
 set errorCorrectLevel
 set maskPattern
 set "oQRCodeModel.dataList="
 call :_getTypeNumber TypeNumber data errorCorrectLevel
 REM If the initial size of the console is too small to display a large size QR Code image,
 REM you can un-remark the next line to auto resize the console window.
 REM call :autoResizeScr typeNumber 20
 set typeNumber
 call :QRCodeModel.addData oQRCodeModel.dataList oQRCodeModel.dataCache data
 set oQRCodeModel.dataList
 call :QRCodeModel.make oQRCodeModel typeNumber errorCorrectLevel maskPattern
 call :paint oQRCodeModel.modules oQRCodeModel.moduleCount
endlocal
exit /b
REM end of :QRCode.makeCode
REM ***
:QRCodeModel.make oQRCodeModel typeNumber errorCorrectLevel specifiedMaskPattern
setlocal enabledelayedexpansion
set "oQRCodeModel.dataList=!%~1.dataList!"
set "oQRCodeModel.dataCache=!%~1.dataCache!"
set /a "typeNumber = %~2, errorCorrectLevel = %~3"
set "BestMaskPattern=!%~4!"
if "!BestMaskPattern!"=="" (
 call :QRCodeModel.getBestMaskPattern oQRCodeModel typeNumber errorCorrectLevel BestMaskPattern
)
title QRCODE.CMD typeNumber: %typeNumber%, errorCorrectLevel: %errorCorrectLevel%, BestMaskPattern: %BestMaskPattern%
call :QRCodeModel.makeImpl oQRCodeModel typeNumber 0 BestMaskPattern errorCorrectLevel
(
 endlocal
 set "%~1.modules=%oQRCodeModel.modules%"
 set "%~1.modules.defined=%oQRCodeModel.modules.defined%"
 set "%~1.moduleCount=%oQRCodeModel.moduleCount%"
 exit /b
)
REM end of :QRCodeModel.make
REM ***
:QRCodeModel.makeImpl oQRCodeModel typeNumber test maskPattern errorCorrectLevel
setlocal enabledelayedexpansion
set /a "typeNumber = %~2, test = %~3, maskPattern = %~4, errorCorrectLevel = %~5"
set "dataList=!%~1.dataList!"
set "dataCache=!%~1.dataCache!"
set /a "moduleCount = typeNumber * 4 + 17"
set "modules="
set /a "iMax= moduleCount * moduleCount, iByteMax = (iMax >> 3) + ^!^!(iMax & 7), iQuadMax = iByteMax << 1"
for /l %%i in (1 1 %iByteMax%) do set "modules=00!modules!"
set "modules.defined=!modules!"
echo;QRCodeModel.setupPositionProbePattern
call :QRCodeModel.setupPositionProbePattern modules 0 0 moduleCount
call :QRCodeModel.setupPositionProbePattern modules "(moduleCount - 7)" 0 moduleCount
call :QRCodeModel.setupPositionProbePattern modules 0 "(moduleCount - 7)" moduleCount
echo;QRCodeModel.setupPositionAdjustPattern
call :QRCodeModel.setupPositionAdjustPattern modules typeNumber moduleCount
echo;QRCodeModel.setupTimingPattern
call :QRCodeModel.setupTimingPattern modules moduleCount
echo;QRCodeModel.setupTypeInfo
call :QRCodeModel.setupTypeInfo modules test maskPattern errorCorrectLevel moduleCount
if !typeNumber! geq 7 (
 echo;QRCodeModel.setupTypeNumber
 call :QRCodeModel.setupTypeNumber modules test typeNumber moduleCount
)
if "%dataCache%"=="" (
 call :QRCodeModel.createData dataCache typeNumber errorCorrectLevel dataList
)
call :QRCodeModel.mapData modules moduleCount dataCache maskPattern
(
 endlocal
 set "%~1.modules=%modules%"
 set "%~1.modules.defined=%modules.defined%"
 set "%~1.moduleCount=%moduleCount%"
 exit /b
)
REM end of :QRCodeModel.makeImpl
REM ***
:QRCodeModel.getBestMaskPattern oQRCodeModel typeNumber errorCorrectLevel BestMaskPattern
echo; & echo;QRCodeModel.getBestMaskPattern & echo;
setlocal enabledelayedexpansion
set "oQRCodeModel.dataList=!%~1.dataList!"
set "oQRCodeModel.dataCache=!%~1.dataCache!"
set /a "typeNumber = %~2, errorCorrectLevel = %~3"
set /a "minLostPoint = 1 << IMSB ^ -1, pattern = 0"
for /L %%i in (0 1 7) do (
 call :QRCodeModel.makeImpl oQRCodeModel typeNumber 1 %%i errorCorrectLevel
 call :QRUtil.getLostPoint oQRCodeModel lostPoint
 echo;pattern: %%i, lostPoint: !lostPoint!
 if !minLostPoint! gtr !lostPoint! (
  set /a "minLostPoint = lostPoint, pattern = %%i"
 )
)
(
 endlocal
 set "%~4=%pattern%"
 exit /b
)
REM end of :QRCodeModel.getBestMaskPattern
REM ***
:QRUtil.getLostPoint oQRCodeModel.qrCode lostPoint
echo; & echo;QRCodeModel.getLostPoint & echo;
setlocal enabledelayedexpansion
set "modules=!%~1.modules!"
set /a "moduleCount = %~1.moduleCount, lostPoint = 0, rm = moduleCount - 1, cm = rm, m_2 = rm - 1"
set "LEQ=-1-"
set moduleCount
for /L %%r in (0 1 %rm%) do for /L %%c in (0 1 %cm%) do (
 set /a "sameCount = 0, ibs = %%c + %%r * moduleCount, iqs = ibs >> 2"
 for %%a in (!iqs!) do (
  set /a "dark = 0x!modules:~%%a,1! >> (3 ^^ (ibs & 3)) & 1"
 )
 for %%L in (-1 0 1) do (
  set /a "t = %%r + %%L, t |= moduleCount %LEQ% t"
  if !
  


 

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

  • 批处理制作二维码生成器

相关文章

  • DOS下联网的方法
  • 用批处理网络映射驱动器后自动修改磁盘卷标名脚本
  • DOS批处理文件
  • DOS批处理高级教程 第五章 set命令详解
  • 一个“灵异”批处理引发的思考加补充说明
  • Cmd 启动命令解释器 Cmd.exe 的新实例
  • 用批处理设置IP安全策略的代码
  • Windows命令行bat批处理延迟sleep方法(批处理延时)
  • CMD进入控制面板的命令小结
  • win7创建wifi热点脚本分享

文章分类

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

最近更新的内容

    • win2000/XP停止打印.bat
    • 检测ip格式是否正确的批处理
    • 用批处理写的后门 永不被杀
    • 用DOS命令快速把整个系统情况摸个清
    • 批处理BAT实现正弦曲线和抛物线代码
    • windows下通过批处理快速批量更换IP方法
    • Windows下用命令行修改IP地址的方法详解(附批处理文件)
    • 批处理bat递归计算N!的实现代码
    • win32下的命令行集合
    • 批处理技术内幕 ECHO命令介绍

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

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