執行bat檔但無法帶入參數 #365
Unanswered
KamiyaMinoru
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
我寫了一個bat, 內容是:
md %date:~8,2%%date:~0,2%%date:~3,2%
這個bat可以讓我半自動的建立一個用日期為名稱的資料夾
我本來想利用以讓QTabbar呼叫它的方式運作, 譬如: 當我右鍵點擊分頁, 它就呼叫該bat, 也就是在該分頁的目錄下建立資料夾
但問題是, QTabbar似乎不接受run的%cd%參數
執行它的時候會跳出一個會倒數的錯誤視窗(偏偏那個視窗的位置很怪, 跑到畫面外了, 根本看不到訊息)
於是我嘗試把bat內容改為
md "%CD%\%date:~8,2%%date:~0,2%%date:~3,2%
這樣理論上會運作, 但實際上它產生的資料夾仍然會出現在我放置該bat的目錄, 而不是我指定分頁的目錄
請問我該怎麼修改?
--
I wrote a bat file with the content:
md %date:~8,2%%date:~0,2%%date:~3,2%
This bat file allows me to semi-automatically create a folder named after the current date.
Originally, I wanted to use it with QTabbar, so that when I right-click on a tab, it would run the bat file and create the folder in the directory of that tab.
However, it seems that QTabbar does not accept the %cd% parameter for running commands. When I try to execute it, an error window pops up with a countdown (weirdly, the position of this window is off-screen, so I can't even see the message).
I then tried modifying the bat file content to
md "%CD%\\%date:~8,2%%date:~0,2%%date:~3,2%
thinking that this should theoretically work, but in reality, the folder is still being created in the directory where the bat file is located, instead of the directory of the specified tab.Please advise on how I should modify the bat file to achieve the desired behavior.
Beta Was this translation helpful? Give feedback.
All reactions