batch-file - 打开带有给定字符串的 URL |在每次 URL 运行时从字符串中去除一个字符

标签 batch-file

创建的批处理文件:

@Echo off&SetLocal EnableExtensions EnableDelayedExpansion
set execute counter=0
Set "Pass=45454545854545854254545454"
Echo Password is:%Pass%
start "" https://xxx.xxx/xxx/%pass%
:test
set "Pass=%Pass%"
set "Pass=!Pass:~1,-1!
echo Password is :%Pass%
start "" https://xxx.xxx/xxx/%pass%
goto test

需求 : 我想用给定的 %pass% 打开 URL字符串,在每个循环中,我想从字符串中删除最后一个字符,直到 URL 保留一个字符。

例子:
1st url : https://xxx.xxx/xxx/45454545854545854254545454
2nd url : https://xxx.xxx/xxx/4545454585454585425454545
.......
last url : https://xxx.xxx/xxx/4

最佳答案

您可以使用更少的代码来完成此操作。

@echo off
Set "Pass=45454545854545854254545454"
:loop
echo https://xxx.xxx/xxx/%pass%
set "pass=%pass:~0,-1%"
IF DEFINED pass GOTO loop

关于batch-file - 打开带有给定字符串的 URL |在每次 URL 运行时从字符串中去除一个字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53766945/

相关文章:

batch-file - 如何从批处理文件中的文本文件创建数组?

batch-file - 在打开 Internet Explorer 选项卡之前运行 tomcat

batch-file - 在dos下使用通配符删除目录

batch-file - 只需使用 WinRAR 命令行批量压缩 1 个文件夹?

string - 为什么子字符串不能与命令行参数一起使用?

windows - Windows CMD 文件中提示管理员访问的示例

windows - 括号中的 icacls

batch-file - diskpart 按磁盘标签选择

batch-file - 批处理文件不发送串行命令

windows - 使用批处理文件运行快捷方式