如何使用批处理文件使文本文件显示为自己键入? [英] How do I make a text file appear to type itself using a batch file?
本文介绍了如何使用批处理文件使文本文件显示为自己键入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要实现的是让我的批处理文件打开记事本并自动开始输入.到目前为止,这是我的代码:
What I'm trying to achieve is for my Batch file to open Notepad and start typing automatically. Here's my code so far:
@echo off
Start notepad
但是我该去哪里呢?我试过了:
but where do I go from here? I've tried:
@echo off
Start notepad
type "stuff"
exit
和类似的东西,但没有用.
and similar things but it didn't work.
有没有办法在 Batch 中做到这一点?
Is there a way to do that in Batch?
推荐答案
这是我制作的一个小玩具,用于将 lineN 变量中的文本以准人类的风格输入到控制台屏幕上.
Here's a little toy I whipped up to type out the text that's in the lineN variables, in a quasi-human style, to the console screen.
有关如何加快或减慢速度的提示,请参阅代码.
See the code for a tip on how to speed it up or slow it down.
@echo off
:: Ghost typer
setlocal enableextensions enabledelayedexpansion
set lines=6
set "line1=Twinkle twinkle little star"
set "line2=How I wonder what you are"
set "line3=Up above the world so high"
set "line4=Like a diamond in the sky"
set "line5=Twinkle twinkle little star"
set "line6=How I wonder what you are"
for /f %%a in ('"prompt $H&for %%b in (1) do rem"') do set "BS=%%a"
for /L %%a in (1,1,%lines%) do set num=0&set "line=!line%%a!"&call :type
pause>nul
goto :EOF
:type
set "letter=!line:~%num%,1!"
set "delay=%random%%random%%random%%random%%random%%random%%random%"
set "delay=%delay:~-6%"
if not "%letter%"=="" set /p "=a%bs%%letter%" <nul
:: adjust the 3 in the line below: higher is faster typing speed
for /L %%b in (1,3,%delay%) do rem
if "%letter%"=="" echo.&goto :EOF
set /a num+=1
goto :type
这篇关于如何使用批处理文件使文本文件显示为自己键入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文