0

I have created a shortcut to Chrome on Windows 7.

I have modified the target line in the shortcut such that it ends in the argument to start Chrome in incognito and kiosk modes and opens to a specific URL

E.g. start chrome --incognito --kiosk www.someplace.com/?machine_label=01

Curious if you can advise me on the following;

  1. I want the target url be machine specific E.g. in a lab with 30 numbered machines, how would have a single shortcut/bat-file that directs the url to that machine's number.

  2. And I would like to adjust the url domain on the fly.

E.g.

  • start chrome --incognito --kiosk www.someplace.com/?machine_label=01
  • start chrome --incognito --kiosk www.someplace.com/?machine_label=02
  • start chrome --incognito --kiosk !MyURL!/?machine_label=!MachineNum!

Right now I have a .bat file on a network drive (allows me to adjust the domain on the fly), but then I adjust the URL manually.

I could have a separate .txt file with MAC addresses and those machine's assigned numbers. However, I am not familiar enough with windows batch to know how to then define my .bat file to check that file and input the appropriate URL.

I'd love your advice on how best to do what I am asking, or a better way to get the same result.

1

Every computername is unique, and every computer has its name stored in %COMPUTERNAME%.

The most logical thing to do would be to use the following url:

start chrome --incognito --kiosk www.someplace.com/?machine_label=%COMPUTERNAME%

This is by far the easiest method to do.

| improve this answer | |
1

Save this as a batch script (name it anything you like):

@echo off
setlocal enabledelayedexpansion
pushd %~dp0
set URL=www.someplace.com
for /f "tokens=1,2 delims=_ " %%a in ('type MachineNumbers.txt') do (
 set MAC=%%b
 set MAC=!MAC::=-!
 for /f "tokens=* delims=" %%c in ('getmac ^| find "!MAC!"') do start chrome --incognito --kiosk %URL%/?machine_label=%%a
)
popd

You can change the value of URL variable to change a domain name on the fly, BUT, it sets the domain name for all machines. (You didn't specify a pattern to assign different domain names to different machines).

...And save the MAC address to machine number binding as follows (separated each set with underline) to a file called MachineNumbers.txt. You can also save MAC addresses using dashes (e.g. 00-00-00-00-00-03):

01_00:00:00:00:00:01
02_00:00:00:00:00:02
03_00:00:00:00:00:03
.
.
.
30_00:00:00:00:00:30

Put both files in the same directory in a network share, and create a shortcut to the script on all computers. Depending on the number of systems, it takes some seconds to generate the right URL for you.

| improve this answer | |
  • Your FOR loop does an echo, doesn't actually start the command. Typo? ;) – LPChip Mar 5 '17 at 20:45
  • @LPChip Sorry, not a typo actually, but an alternate command to see if it works in the test environment. Missed this one before posting. Thank you. – NetwOrchestration Mar 5 '17 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.