数值操作

2016年1月11日 0 条评论 474 次阅读 0 人点赞

整数加100为另一数平方,加168为另一数平方

@echo off
setlocal enabledelayedexpansion
for /l %%b in (1 1 999) do (
 for /l %%a in (1 1 999) do (
  set/a c=%%a*%%a-%%b*%%b
  if !c!==68 (
    if %%a gtr %%b (set/a x=%%a*%%a-168) else (set/a x=%%b*%%b-168)
      echo !x!
      pause
      goto :eof
  )
 )
) 

99乘法口诀

@echo off&setlocal enabledelayedexpansion
for /l %%i in (1 1 9) do (set b=
   for /l %%j in (1 1 %%i) do (
   set /a a=%%i*%%j
   set b=!b! %%i*%%j=!a!
   )
echo !b!
)
pause

::@echo off &setlocal enabledelayedexpansion
::for /l %%a in (1 1 9) do (
::        for /l %%b in (1 1 %%a) do (
::                set/a res=%%a*%%b
::                set "res=!res!  " %======此处用来对齐=========%
::                set/p=%%ax%%b=!res:~0,2!  <nul
::        )
::        echo.
::) 
::pause>nul

文本内容替换

@echo off
setlocal enabledelayedexpansion
set "path1=C:\a.txt"
set "source=/ast.asp/0-0-1-100000-"
set "dst=ast.asp?q="
for /f "tokens=*" %%i in ('type "%path1%"') do (
set a="%%i"
set "a=!a:%source%=%dst%!"
echo !a:~1,-1!>>b.txt
)
endlocal 

Sevenfal

这个人太懒什么东西都没留下

文章评论(0)