2013-12-23 53 views
0

嗨,我是新手腳本 我創建此示例腳本來過濾掉日誌文件中的所有時間戳 當我在cmd提示符下手動使用它時,它適用於我,但同樣不起作用一個.bat文件。批處理腳本問題

@ECHO OFF 

: ************** Report Tracking in FR ************************************************* 
: ********** to find keywords relevent Timestamps ************************************** 
: ****************** From the Log files ************************************************ 

cd F:\oracle\Middleware\user_projects\domains\EPMSystem\servers\FinancialReporting0\logs 
(FOR %G IN (*.log) do (find /i "Name:" "%G"))> out.log 

任何想法,以什麼可能丟失我

+0

嗨Stephan, 但改變工作,但現在cmd跳轉到我的腳本所在的目錄,並且不執行cmd (FOR %% G IN(* .log)do(find/i「Name :」 「%% G」))> out.log 在所需的文件夾 F:\ ORACLE \中間件\ user_projects \域\ EPMSystem \服務器\ FinancialReporting0 \日誌 謝謝您的投入! – user3124129

+0

'cd/d「F:\ oracle \ Middleware \ user_projects \ domains \ EPMSystem \ servers \ FinancialReporting0 \ logs」<---試試命令的格式。 – foxidrive

+0

謝謝foxiderive。 @ user3124129如果您對我的回答發表評論,或者您明確寫了「@ Stephan」,我會收到一條消息;如果您對您的問題發表評論,我不會收到消息。 – Stephan

回答

3

問題:

(FOR %G IN (*.log) do (find /i "Name:" "%G"))> out.log 

在批處理文件,你必須在百分號爲「FOR-不同的雙:

(FOR %%G IN (*.log) do (find /i "Name:" "%%G"))> out.log 

此外,如果您嘗試更改爲另一個驅動器使用cd /d

+0

謝謝我是這個社區的新手..這是金!我希望我能學到很多,並且像你一樣貢獻! – user3124129