I am currently trying to get a list of items saved from a profile on an old machine and then sent to the new machine and profile, being that the profile is the same.
On Windows 7 the location %AppData%\Microsoft\Sticky Notes
stores the .snt
for sticky notes. That location exists natively all the way to Windows 10 1511.
On Windows 10 1607 it has been moved to %LocalAppData%\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState" and changed to
plum.sqlite`.
If you upgraded from anything earlier than Windows 10 1607 it will have made a Legacy
folder with ThresholdNotes.snt
in it and that will convert over to the plum.sqlite
.
I am writing a nested .bat
which will:
IF old sticky notes location on the new computer exists
check for pulled .snt
file, then copy over
ELSE
check for pulled .snt file
IF new legacy location not exist
create then copy and rename .snt
to convert
ELSE
copy,rename
IF old sticky notes location not exist
then check for new .sqlite
file
ELSE
copy new file to new location
Otherwise say there are none detected.
But it seems I may be writing it wrong or something because I have placed a pause in the .bat
but it just closes immediately when ran.
Here is the current Pull part where it retrieves the .snt
or .sqlite
. Variables first and then the actual action part.
REM Saves Users Sticky Notes
Set StickyNotes="%userprofile%\AppData\Roaming\Microsoft\Sticky Notes\StickyNotes.snt"
Set FlashStickyNotes="%~dp0%USERNAME%\StickyNotes"
REM Saves Users Sticky Notes From Win 10 1607+
Set StickyNotesWin10="%userprofile%\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\plum.sqlite"
Set FlashStickyNotesWin10="%~dp0%USERNAME%\StickyNotesWin10"
Title Pulling StickyNotes
if exist %StickyNotes% ( xcopy %StickyNotes% %FlashStickyNotes% /f /y ) ELSE if exist %StickyNotesWin10% (
xcopy %StickyNotesWin10% %FlashStickyNotesWin10% /f /y ) else Echo "No Sticky Notes Detected"
^^This part seems to work just fine and not have any problems
Here's the Push part and this is where I seem to have trouble but maybe its formatting? Variables first and then the actual action part.
REM Saves Users Sticky Notes
Set StickyNotes="%userprofile%\AppData\Roaming\Microsoft\Sticky Notes\"
Set FlashStickyNotes="%~dp0%USERNAME%\StickyNotes\StickyNotes.snt"
REM Saves Users Sticky Notes From Win 10 1607+
Set StickyNotesWin10="%userprofile%\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\"
Set FlashStickyNotesWin10="%~dp0%USERNAME%\StickyNotesWin10\plum.sqlite"
Title Pushing StickyNotes
REM if old sticky notes location on the new computer exists, then check for pulled .snt file, then copy over ELSE
REM if new sticky notes location exists, check for pulled .snt file, if new legacy location not exist, then create and then copy and rename .snt to convert, else copy,rename
REM if old sticky notes location not exist, then check for new .sqlite file, if exist then copy new file to new location ELSE
REM otherwise say there are none detected
IF exist "%userprofile%\AppData\Roaming\Microsoft\Sticky Notes\"( IF exist "%FlashStickyNotes%"( xcopy %FlashStickyNotes% %StickyNotes% /F /Y )
IF exist "%userprofile%\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\"(
IF exist "%FlashStickyNotes%"(
IF not exist "%userprofile%\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\Legacy"(
mkdir "%userprofile%\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\Legacy"
xcopy %FlashStickyNotes% "%userprofile%\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\Legacy\ThresholdNotes.snt" /F /Y
) else IF exist "%userprofile%\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\Legacy"((
xcopy %FlashStickyNotes% "%userprofile%\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\Legacy\ThresholdNotes.snt" /F /Y
)
)
) else IF not exist "%StickyNotes%" (
IF exist %FlashStickyNotesWin10% (
copy %FlashStickyNotesWin10% %StickyNotesWin10% /Y
)
)
) ELSE Echo "No Sticky Notes Detected"