我使用以下語法引用與批處理腳本位於同一文件夾中的其他文件: CALL%0 .. \ SecondBatch.cmd並且適用於Windows 2003服務器,但不與2008服務器一起使用。任何想法都是值得歡迎的Rafer to the other batch in the same folder in 2008 2008
1
A
回答
0
您是否以Admin啓動腳本(這會將目錄更改爲system32)?嘗試使用: "%~dpfs0\SecondBatch.cmd"
因此,您將使用完整路徑調用第二個.bat。調用運行批次的同一目錄下另一個批處理文件的
0
正確的方法應該是
@echo off
setlocal enableextensions
rem This is first.cmd , Let's call second.cmd
call "%~dp0\second.cmd"
但有可能是一個問題。如果first.cmd已用引號調用,並且在first.cmd內,則當前驅動器已更改,參考文件%~dp0
應返回當前批處理文件的路徑fails。
如果這是你的情況下,這種類型的結構可以用來
@echo off
setlocal enableextensions
rem This is first.cmd , Let's call second.cmd
call :getScriptPath folder
call "%folder%\second.cmd"
exit /b
:getScriptPath returnVar
set "%~1=%~dp0"
goto :EOF
相關問題
- 1. Group Dispatcher.Invoke in the same function
- 2. .net core&.net framework in the same team
- 3. $(window).load OR $(window).scroll in the same function?
- 4. SELECT some column and count the rows in the same query
- 5. python import in same folder
- 6. Perforce in the Cloud
- 7. DOMNodeInserted in the IE
- 8. About the Stanford CoreNLP in chinese model
- 9. from csh to bash and re-source the same file
- 10. FileWriter,How to write on the same document
- 11. .text&.attr in jquery not in the IE
- 12. 怎樣寫像<a href="#id"> which link to the same page in PHP?
- 13. <a href in fireforx adds a %1B to the code but works fine with all other browsers?
- 14. Elasticsearch集羣中的「IN THE SAME NETWORK」中的含義是什麼?
- 15. Man in the Middle Attacks and SSL
- 16. Java:remove-common-words-method in the API?
- 17. readline with console.log in the background
- 18. how to send post to remote url and redirect to the url in php
- 19. 正文中的「The」或「the」正則表達式「The other one there,the blithe one」。
- 20. NSPredicate for checking the same date
- 21. Multiple DatabaseHelper for the same database
- 22. ItextSharp-Exception in the reader initialization「The document has no page root」
- 23. 保存的<a href> in the localstorage
- 24. kendo mvc grid is splitting in in to 2 parts on the model binding of a list values
- 25. 如何使HTML <a target='_parent'> point to the same as javascript window.opener?
- 26. input type =「image」and input type =「button」to draw in html5 canvas,the button is working,but I need the image to working
- 27. Seekng in audio tag and Scrolling the text
- 28. CAML Query for retrieveing ListItems in the hierarchal order
- 29. RegEX for URLrewriting if not「.php」in the path
- 30. 「width:whatever-left-in-the-line;」的CSS是什麼?
當跑蝙蝠「CALL%〜dpf0 \ .. \ SecondBatch.cmd」得到這個錯誤 - 不被識別爲內部或外部命令 – user3041480
嘗試與'調用「」%〜dpfs0 \ SecondBatch.cmd「」' – npocmaka
仍然沒有 - :(( – user3041480