I want to create a shortcut that launches chrome with an HTML file in the same directory as the shortcut. I also need it to launch chrome with the following parameters --new-window --disable-web-security --user-data-dir="c:/chromedev"
Currently the "Target" line of my shortcut looks like this:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" ./specViewer.html --new-window --disable-web-security --user-data-dir="c:/chromedev"
Launching this gives me the ERR_NAME_NOT_RESOLVED
error
I've also tried this:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" specViewer.html --new-window --disable-web-security --user-data-dir="c:/chromedev"
With no such luck, as then it tries to search the internet for my file.
Any ideas on a solution to properly launch the local file in chrome with the command line parameters?
Best Answer
The OP's answer is correct as far as it goes. However, you can get a Windows shortcut to launch relative to the current directory.
While you can use Windows Environment Variables in shortcuts, there are a few volatile ones that cannot be used (such as
%CD%
).As the OP suggested, using a batch file is an excellent way to bypass this restriction:
You can also create a
New Shortcut
with the following properties:CRITICAL: make sure
Start in
is empty; this will start command prompt in the current directory.Notice how we launched command prompt, which can use dynamic variables such as
%CD%
. And you'll probably want to change the icon on the shortcut to look like Google Chrome, or whatever program you are launching.For more on the peripheral details, see this question:
Making a Windows shortcut start relative to where the folder is? - Stack Overflow