找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 18841|回复: 3

echo输出

  [复制链接]
发表于 2018-4-6 21:32:17 | 显示全部楼层 |阅读模式
本帖最后由 小渣飞 于 2018-4-6 21:33 编辑

用批处理echo输出一下完整内容,价格微信私聊 微信号 13530874825


fdpath="c:\666"
arr=Split("%,{,},[,],&,^,#,`, ", ",")
fdpath=Replace(fdpath, "\", "/")
If Right(fdpath, 1) = "/" Then fdpath=Left(fdpath, Len(fdpath)-1)
If Len(fdpath) = 2 Then fdpath=fdpath & "/"
Set ShellApp = CreateObject("Shell.Application")
Set oWindows = ShellApp.Windows
For Each SubWds In oWindows
If LCase(SubWds.LocationURL) = LCase("file:///" & encode(fdpath, arr)) Then
SubWds.Quit()
End If
Next
Function encode(ByVal path, ByRef arr)
For i=0 To UBound(arr)
path=Replace(path, arr(i), "%" & Hex(Asc(arr(i))))
Next
encode=path
End Function
 楼主| 发表于 2018-4-6 21:40:37 | 显示全部楼层
有人吗脑壳疼=-=
 楼主| 发表于 2018-4-7 18:21:23 | 显示全部楼层
已解决

echo fdpath=^"c:\666^" >> 1.txt
echo arr=Split(^"%%,{,},[,],^&,^^,#,`, ^", ^",^") >> 1.txt
echo fdpath=Replace(fdpath, ^"\^", ^"/^") >> 1.txt
echo If Right(fdpath, 1) = ^"/^" Then fdpath=Left(fdpath, Len(fdpath)-1) >> 1.txt
echo If Len(fdpath) = 2 Then fdpath=fdpath ^& ^"/^" >> 1.txt

echo Set ShellApp = CreateObject(^"Shell.Application^") >> 1.txt
echo Set oWindows = ShellApp.Windows >> 1.txt
echo For Each SubWds In oWindows >> 1.txt
echo If LCase(SubWds.LocationURL) = LCase(^"file:///^" ^& encode(fdpath, arr)) Then >> 1.txt
echo SubWds.Quit() >> 1.txt
echo End If >> 1.txt
echo Next >> 1.txt
echo Function encode(ByVal path, ByRef arr) >> 1.txt
echo For i=0 To UBound(arr) >> 1.txt
echo path=Replace(path, arr(i), ^"%%^" ^& Hex(Asc(arr(i)))) >> 1.txt
echo Next >> 1.txt
echo encode=path >> 1.txt
echo End Function >> 1.txt
发表于 2018-4-8 12:45:39 | 显示全部楼层
特殊字符比较多的时候echo命令不方便,可以试试这样:批处理动态生成指定内容的脚本
http://bbs.bathome.net/viewthread.php?tid=32419#pid155779
http://bbs.bathome.net/viewthread.php?tid=33399#pid159265
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-17 01:35 , Processed in 0.016697 second(s), 8 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表