|
本帖最后由 conlin888 于 2023-7-3 11:53 编辑
这个脚本没有临时文件,运行时将wcs重命名为bat, 运行后恢复原状:
TEAM ENVI^ ENVIMODE=1|ENVI^ FORCELOCAL=1|ifex ['%~1'<>'' & "%~1"],!exit file
Team set space= |set$ nl=d a|mstr &r=-1,8,%random%
Team read %curfile%,**,file|read %1,**,file-1
Team fdir v1=%1|name v2=%1|set new=%v1%\%v2%.wcs
@Team @sed -ni ;;n=?1,%nl%exit%space%//:%nl%,,%nl%%file%|calc n=%n%+1|read -*,%n%+0,file,file
@writ-ansi *c *-nl %new%,$+0,goto :%&r%%nl%%file%%nl%:%&r%%nl%%file-1%
exit //:
TEAM ENVI^ ENVIMODE=1|ENVI^ FORCELOCAL=1
Team name -ext &name=%curfile%|exec =*cmd.exe /c ren "%curfile%" "%&name%.bat"
Team exec =*cmd.exe /c "%curdir%\%&name%.bat" %*|exec =*cmd.exe /c ren "%curdir%\%&name%.bat" "%&name%"
exit //:
|
|