****************************************************************************
Cut-and-paste just-follow-my-footsteps tutorial for creating batch file
shortcut which work well in Windows 7 & 10 in your personalized menus
****************************************************************************
This tutorial assumes these basics that everyone should be able to do:
NOTE: All personalized paths below are examples (use your own paths).
- We want a shortcut to a batch file which accepts user input.
- Clicking the shortcut should pop up the program asking for user input.
- We want the shortcut to have a distinctive small icon (for menus & bars).
- We want the shortcut in the left-side start menu (alphabetical list).
- We want the shortcut in the orthogonal start menu (tiled start menu).
- We want the shortcut in a personal cascade menu (on the task bar).
- We want the shortcut in the task bar.
- We want to be able to run the command at both Cortana & the "Run" box.
- We don't want to have to click Yes to UAC permission queries.
Here are the two batch files we will set up for Windows shortcuts:
- curlme.bat (check your current WLAN IP address & ping speeds)
- killgw.bat (kill the gateway to protect from VPN dropouts).
Note: curlme is shorter & doesn't ask for UAC permission, so it's easier.
----------------------------------------------------------------------------
1. Create & test the batch file above (or any batch file requiring input).
C:\app\os\bin_shell\curlme.bat
@echo off
set pingit=
www.google.com
:curlme
C:\app\network\curl\bin\curl.exe
icanhazip.com
timeout 1 /nobreak>nul
ping %pingit%
pause
goto curlme
:stop
exit
----------------------------------------------------------------------------
2. Set Windows to eliminate additional default text onto shortcut names:
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\NamingTemplates
Create this variable and value.
ShortcutNameTemplate = "%s.lnk"
----------------------------------------------------------------------------
3. Create & test a desktop shortcut to that batch file.
curlme.bat.lnk
Target = C:\app\os\bin_shell\curlme.bat
StartIn = C:\app\os\bin_shell
----------------------------------------------------------------------------
4. Change the icon for that batch file shortcut.
Right click on the shortcut > Properties > [Change Icon...]
Note: If you run this step out of sequence, you won't have the
same selection of icons, but you can always manually enter:
Look for icons in this file = %SystemRoot%\System32\SHELL32.dll
----------------------------------------------------------------------------
5. Notice that you can't right click to "Pin to Start".
Nor can you right click to "Pin to taskbar".
Also notice you can't just drag the shortcut into the taskbar.
But at least you can copy the shortcut to your personal cascade menu:
C:\ProgramData\Microsoft\Windows\Start Menu\menu\os\bat_shell\curlme.lnk
----------------------------------------------------------------------------
6. You might think to put the shortcut in either of these folders:
%appdata%\Microsoft\Windows\Start Menu\Programs\ <-- for just the user
%programdata%\Microsoft\Windows\Start Menu\Programs\ <-- for all users
Then it will show up in the left-side Start Menu.
And from there, you can right click on the list to "Pin to Start"
which will copy it as a tile to the orthodox side of the Start Menu.
But you still won't be able to copy the shortcut to the task bar.
----------------------------------------------------------------------------
7. Notice that you can't right-click and Pin to taskbar this shortcut yet.
Right click on the shortcuts and change the Target line from:
From Target = C:\app\os\bin_shell\curlme.bat
To Target = %windir%\system32\cmd.exe /K "C:\app\os\bin_shell\curlme.bat"
And
From Target = C:\app\os\bin_shell\killgw.bat
To Target = %windir%\system32\cmd.exe /K "C:\app\os\bin_shell\killgw.bat"
Now when you right-click on this shortcut, you can "Pin to taskbar".
----------------------------------------------------------------------------
8. Notice that you can run the curlme command from Cortana:
Cortana > curlme > Enter
But you can't run it yet in the "Run" box.
(Right-click on Start) > Run > curlme > Enter
Which outputsthe error: Windows cannot find 'curlme'.
----------------------------------------------------------------------------
9. Notice that you can't yet run curlme from the Windows "Run" box.
Rightclick Start > Run > curlme <=== this fails
Navigate to the "App Paths" registry location:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\
Right click on "App Paths" > New > Key
Name the key "curlme.exe" <=== it must end with ".exe" to work!
Set the default value = C:\app\os\bin_shell\curlme.bat
Now you can run curlme from the Windows "Run" box.
Rightclick Start > Run > curlme <=== this works
----------------------------------------------------------------------------
10. Optionally tell the "Run" box to remember your previous commands.
Start > Settings > Personalization > Start > Show most used apps = On
----------------------------------------------------------------------------
11. Once you have curlme working, it's time to deal with UAC permissions.
Obtain the kill-gateway batch file which requires UAC permissions.
<
https://www.liquidvpn.com/billing/dl.php?type=d&id=49>
For convenience, rename the batch file:
FROM: LiquidVPN-Kill-Switch.bat
TO: killgw.bat
And put the file in your batch-command directory:
C:\app\os\bin_shell\killgw.bat
Note: The killgw.bat file requires administrator priveleges
so we will have one extra step to selectively disable UAC for killgw.
----------------------------------------------------------------------------
12. Run steps 1 through 10 above on this new batch file.
Then, if you can figure out how to get the UAC prompt to go away
without loading 3rd-party software & without turning UAC off totally,
let all of us know - because I can't figure that out yet.
- Scheduled tasks isn't going to work for this command.
- Microsoft Application Compatibility Toolkit might work.
- Third-party solutions almost always come at a compatibility cost.
----------------------------------------------------------------------------
--
I only ask you to run this tutorial, and tell us what didn't work, and,
then for all of us to try to figure out a good solution to step #12.