View Single Post
Old 06-08-2021, 04:03 PM   #1261
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 47,030
Karma: 169810634
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by dieselnutjob View Post
The second line of the .bat script says
set KINDLE=%LocalAppData%\Amazon\Kindle

what I actually have is c:\Users\myname\AppData\Local\Amazon\Kindle

if I go to a command prompt and type
C:\>cd %LocalAppData%

I go to

C:\Users\myname\AppData\Local>

the third line of the script is
if not exist "%KINDLE%\application\Kindle.exe" goto :nokindle

so that means %LocalAppData%\Amazon\Kindle\applications\Kindle.e xe

which on my system is C:\Users\myname\AppData\Local\Amazon\Kindle\applic ations\Kindle.exe

I don't have an applications folder in there.

My Kindle.exe is at
C:\Program Files (x86)\Amazon\Kindle\Kindle.exe
That script assumes that you have installed Kindle4PC in it's default location. The %LocalAppData% variable is a Windows environment variable pointing to X:\Users\username\AppData\Local where X is the drive letter and username is the local user name. See the Complete list of environment variables on Windows 10 for a list of these variables.

Since you did not install Kindle4PC in it's default location, the script is unable to find it. You could try defining the Kindle variable as C:\Program Files (x86)\Amazon\Kindle and changing any references to remove the \application from the string. I don't have a Kindle4PC install in a non-standard directory so the storage and updates directories may be in different locations for you. If so, change the locations to match in the batch file. I went on the assumption that the data storage would be in the same location. Sample below for your kindle.exe install location.

Edit: the line reading "if exist "%KINDLE%\storage" if not exist "%KINDLE%\storage\" del /Q "%KINDLE%\storage" " doesn't really make sense but I didn't bother changing it.

Code:
@echo off
set KINDLE=%LocalAppData%\Amazon\Kindle
set KINDLE_EXE=%PROGRAMFILES(X86)%\Amazon\Kindle
if exist "%KINDLE_EXE%\Kindle.exe" goto :found
if not exist "%KINDLE%\application\Kindle.exe" goto :nokindle
:found
rem still not sure what the following line is for
if exist "%KINDLE%\storage" if not exist "%KINDLE%\storage\" del /Q "%KINDLE%\storage"
if exist "%KINDLE%\updates" rmdir /S /Q "%KINDLE%\updates"
echo This file disables Kindle for PC downloads. > "%KINDLE%\updates"
echo Kindle for PC downloads are now disabled
goto :exit
:nokindle
echo Cannot disable downloads - Kindle for PC is not installed at expected location
:exit
pause

Last edited by DNSB; 06-09-2021 at 01:26 AM. Reason: Added comment on if exist/if not exist line. Modified batch file tol work with default and program files install locations.
DNSB is offline