
CODE: [Copy to clipboard]SQL_do.sql@echo off
sqlplus /nolog @SQL_do.sql
exit
CODE: [Copy to clipboard]如果非要用一个BAT来实现,恐怕只有手工输入尖括号^进行转义吧?--Use your own username, password, database
CONN username/password@database
SPOOL C:\result.xls
--Use your own SQL
SELECT SYSDATE FROM DUAL;
SPOOL OFF
EXIT
CODE: [Copy to clipboard]@echo off
call:ReversOut "12345&6" strs
::这种方法兼容特殊字符,但会过滤引号。
set/p "tt=%strs%"<nul
echo\&pause
exit
:: /*-------ReversOut--------------
:ReversOut ["string"] [string]
setlocal ENABLEEXTENSIONS
set "str=%~1"
:ReversOut_1
set "strs=%str:~0,1%%strs%"
set "str=%str:~1%"
if defined str goto:ReversOut_1
endlocal&set "%2=%strs%"&goto:eof
:: ---------ReversOut------------*/
CODE: [Copy to clipboard]@echo off||以行首文字重命名txt
for %%a in (*.txt)do call:renm "%%a"
exit
:renm
set "n=" :初始化n,一便n从1开始递增。
set/p t=<"%~1"
set t=%t:.=%
set t=%t:/=%
set t=%t:\=%
set t=%t:?=%
set t=%t::=%
set t=%t:;=%
set t=%t: =%
set t=%t:^*=%
set "t=%t:^<=%"
set "t=%t:^>=%"
set "t=%t:^|=%"
ren "%~1" "%t%%n%.txt"||set n=0&goto:renm1
exit/b
:renm1
set/a n+=1
ren "%~1" "%t%_%n%.txt"||goto:renm1
exit/b
CODE: [Copy to clipboard]@echo off
for %%a in (*.txt)do call:renm "%%a"
exit
:renm
set/p t=<"%~1"
set t=%t:.=%
set t=%t:/=%
set t=%t:\=%
set t=%t:?=%
set t=%t::=%
set t=%t:;=%
set t=%t: =%
set t=%t:^*=%
set "t=%t:^<=%"
set "t=%t:^>=%"
set "t=%t:^|=%"
ren "%~1" "%t%.txt"||ren "%~1" "%t%_1.txt"||ren "%~1" "%t%_2.txt"||ren "%~1" "%t%_3.txt"
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |