[GNC] How to move my Windows 10 2.6.17 to a new Windows, 10 machine?
Norbert Klein
nhklein at gmx.net
Fri Jul 13 04:59:04 EDT 2018
Thanks, Stan,
for sharing your work with all.
But it only makes me feel sorry - I am a non-programmer user of GnuCash :-(
I still hope there will be - some time in the not too distant future - a
program which can be used also by a non-programmer to move a well
working GnuCash system from one Widows 10 computer to a new Windows 10
computer.
Still not giving up hope.
Norbert
On 13.7.2018 5:29, Stan Brown wrote:
> Dick, here is a batch file I use to save and restore my GnuCash settings
> and reports, for transferring them between machines. You'd need to
> change my file names and paths to yours, but still it could save you
> some time.
>
> If you don't want to be elaborate as I am -- my batch files tend to be a
> bit over-engineered -- just look for the "reg" lines. Those are the ones
> that save or restore the settings and reports.
>
>> @set MYECHO=echo off
>> @%MYECHO
>> set RZIPNAME=_stanReports.zip
>> set GFILNAME=_stanSettings.reg
>> setlocal
>> set MYNAME=%@name[%0]
>> if "%1" ne "/?" .and. "%1" ne "-?" .and. "%1" ne "" goto 000_Start
>> echo off
>> echo.
>> echo %MYNAME: Save or restore GnuCash settings
>> echo.
>> echo options:
>> echo /q Quiet
>> echo /v Verbose
>> echo /purge Delete saved log files (used with "save" or "apply")
>> echo save Save settings
>> echo apply Apply saved settings
>> echo purge Delete saved log files.
>> echo Just one of 'save', 'apply', 'purge' is required.
>> echo.
>> echo Settings are saved in %GFILNAME and %RZIPNAME, in the same
>> echo folder as the GnuCash accounting file.
>> quit
>> ********************************************************************************
>> 2018-02-25 new program
>> 2018-03-21 Add the purge option.
>> 2018-03-31 With 'purge', suppress error message if there are no files ...
>> 2018-04-01 ... and also delete GnuCash files in %TEMP%.
>> 2018-04-18 Add /purge as an option, used with "save" or "apply".
>> 2018-05-05 Program didn't abort after an an unknown option.
>>
>> Copyright 2018 Stan Brown, Oak Road Systems http://oakroadsystems.com/
>> ********************************************************************************
>> :000_Start
>>
>> :: Scan the options.
>> set ACTION=none
>> set PURGING=0
>> set VERBOSE=1
>> do while "%1" ne ""
>> iff %1 == save .or. %1 == apply .or. %1 == purge then
>> iff %ACTION ne none then
>> echo %MYNAME: Only one of 'save', 'apply', purge is allowed.
>> cancel
>> endiff
>> set ACTION=%@lower[%1]
>> elseiff %1 == /q then
>> set VERBOSE=0
>> elseiff %1 == /v then
>> set VERBOSE=2
>> elseiff %1 == /purge then
>> set PURGING=1
>> else
>> echo %MYNAME: Unknown option '%1'.
>> cancel 2
>> endiff
>> shift
>> enddo
>> iff %ACTION == none then
>> echo %MYNAME: You need one of 'save', 'apply', or 'purge'.
>> cancel
>> elseiff %VERBOSE == 2 then
>> echo %MYNAME: Plaanning to %ACTION the %@if[%ACTION == purge,files,settings].
>> echo.
>> endiff
>>
>> :: Check existence of files and folders.
>> set GDIR=e:\sb\$\GnuCash
>> iff not isdir "%GDIR" then
>> echo %MYNAME: Financials folder '%GDIR' not found.
>> cancel
>> elseiff not exist "%GDIR\Stan.gnucash" then
>> echo %MYNAME: File Stan.gnucash not found in '%GDIR'.
>> cancel
>> endiff
>> set RDIR=%USERPROFILE\.gnucash
>> set RZIP=%GDIR\%RZIPNAME
>> set GKEY=HKCU\Software\GSettings\org\gnucash
>> set GFIL=%GDIR\%GFILNAME
>> iff %VERBOSE == 2 then
>> echo %MYNAME: Financial database is in folder '%GDIR'.
>> echo %MYNAME: GnuCash reports are in folder '%RDIR'.
>> echo %MYNAME: GnuCash reports are zipped in file '%RZIP'.
>> echo %MYNAME: GnuCash settings are in '%GKEY'.
>> echo %MYNAME: GnuCash settings are exported to file '%GFIL'.
>> echo.
>> endiff
>>
>> iff %ACTION == save then
>> if %PURGING == 1 gosub PurgeAction
>> iff not isdir "%RDIR" then
>> echo %MYNAME: Reports folder '%RDIR' not found.
>> cancel
>> endiff
>> pushd "%RDIR"
>> set ZIPOPT=
>> set OPTS=-r -T -o
>> if %VERBOSE lt 2 set OPTS=%OPTS -q
>> @if %VERBOSE ge 1 echo on
>> zip %OPTS "%RZIP" *
>> @%MYECHO
>> @echo.
>> popd
>> @if %VERBOSE ge 1 echo on
>> reg export %GKEY "%GFIL" /y
>> @%MYECHO
>>
>> elseiff %ACTION == apply then
>> if %PURGING == 1 gosub PurgeAction
>> iff not exist "%GFIL" then
>> echo %MYNAME: Registy export file '%GFIL' not found.
>> cancel
>> endiff
>> iff not exist "%RZIP" then
>> echo %MYNAME: Reports ZIP file '%RZIP' not found.
>> cancel
>> endiff
>> iff not isdir "%RDIR" then
>> echo %MYNAME: Reports folder '%RDIR' not found.
>> input /c /k"yYnN" /l1 Create it?^ %%X
>> echo.
>> if %X == N cancel
>> md "%RDIR"
>> endiff
>> set OPTS=-uo
>> if %VERBOSE == 0 set OPTS=%OPTS -q
>> @if %VERBOSE ge 1 echo on
>> unzip %OPTS "%RZIP" -d "%RDIR"
>> @%MYECHO
>> @echo.
>> @if %VERBOSE ge 1 echo on
>> reg delete %GKEY /f
>> @echo.
>> reg import "%GFIL"
>> @%MYECHO
>>
>> elseiff %ACTION == purge then
>> gosub PurgeAction
>>
>> else
>> echo %MYNAME: Internal error: %%ACTION = '%ACTION'
>> cancel
>> endiff
>> quit
>>
>> :PurgeAction
>> set OPTS=/R /E
>> if %VERBOSE lt 2 set OPTS=/T %OPTS
>> echos %MYNAME: purging ... ``
>> del %OPTS %GC\*.gnucash.20* %TEMP\gnc-report*html;gnucash*log
>> return
>
More information about the gnucash-user
mailing list