1

I am wondering if it is possible to execute JavaScript in a browser window using the command prompt in Windows. Is it possible to start chrome and execute a JS file in that new browser window, all from the command prompt?

5
  • take a look at userscripts (user.js) Commented Jan 9, 2013 at 22:01
  • 1
    It's certainly possible to open a browser to a specific page from the command line... so you could put some JavaScript in an html page and launch a browser so it opens that page. Commented Jan 9, 2013 at 22:47
  • @jahroy I've been trying for over 30 minutes to achieve something like this as a .bat for an answer (anon func takes window.location.search and adds as <script>), but DOS just keeps tripping up over strings. Long story short; write a .html file to do it. Commented Jan 9, 2013 at 22:59
  • Wow... I can't think of anything worse that working with .bat files! Commented Jan 9, 2013 at 23:18
  • You could look at Adobe AIR. Gives you a Webkit wrapper you can write JS for. Commented May 17, 2013 at 5:11

1 Answer 1

1

I doubt it.

I just tried this though:

You can put javascript:alert("moo") in the browser's home page url setting, which will run as soon as you open the browser.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.