0
我想打開使用Windows命令行(或PowerShell)在Chrome中保存的書籤。 書籤不是一個URL,而是一個JavaScript,用於在目標網站自動執行一些任務。 我可以使用命令行觸發整個事件(Chrome啓動+書籤打開)嗎? 或者我可以安排這個任務的其他方法。如何用Windows命令行啓動Chrome書籤?
我想打開使用Windows命令行(或PowerShell)在Chrome中保存的書籤。 書籤不是一個URL,而是一個JavaScript,用於在目標網站自動執行一些任務。 我可以使用命令行觸發整個事件(Chrome啓動+書籤打開)嗎? 或者我可以安排這個任務的其他方法。如何用Windows命令行啓動Chrome書籤?
如何定義書籤?這有點不清楚,請比較Create Bookmarklets - The Right Way
在下一個示例中,.js
和.html
文件存儲在本地,都位於同一文件夾中。然而,也可以存儲在任何地方,比較HTML <script>
src
Attribute:
語法:
<script src="URL">
可能URL屬性值:
- 的絕對URL - 指向另一個網站網站(如
src="http://www.example.com/example.js"
)- 一個相對URL - 網站內指向一個文件(如
src="/scripts/example.js"
)
文件:dir /B /S 40460552.*
d:\bat\SO\40460552.html
d:\bat\SO\40460552.js
Javasript:type "D:\bat\SO\40460552.js"
// JavaScript Document
document.write("Text from script");
alert("script done");
HTML:type "D:\bat\SO\40460552.html"
<!DOCTYPE html>
<html>
<body>
<p>Text from page before script</p>
<script src="40460552.js"></script>
<p>Text from page after script</p>
</body>
</html>
CMD:使用START
command
start "" chrome --allow-running-insecure-content "D:\bat\SO\40460552.html"