AutoExecute of certain command right after factory default - Galaxy Note II Q&A, Help & Troubleshooting

Device rooted, is it possible to write an auto execute batch file (similar to autoexec.bat of windows system) right after factory default?
Main purpose is to copy a list of backup files to specific location (data/data or data/app)

Related

Overwrite File In Use/On Reboot?

OK so I'm working on an app in which I need to copy a file from a local directory ("/Program Files") to the "/Windows" directory. I keep running into IOException errors telling me that the file cannot be accessed because it is being used by another process.
I've tried overwriting, deleting, renaming, moving... I tried using the MoveFileEx function to move on reboot, but the kernel32.dll is not available in Windows Mobile. I've also tried creating a separate .exe that will perform the copy/replace on reboot. I've tried just creating it in the startup folder, but by the time it launches the file is already being used. I've also created reg entries in HKLM>init to launch it, but it still seems to be starting too late...
However, if I create a simple .CAB installer that does nothing but place these files into the "/Windows" directory. The install will run then prompt for a soft reset.
So I have three questions...
1) Is there any way to force an overwrite of a file that is in use?
OR
2) How can I perform the copy/replace on reboot early enough that the files aren't in use?
3) Is the .CAB installer replacing the files at install or on reboot? and how?
Thanks in advance!!!
Kliptik

[Q] Mod a mod to add custom apks preinstalled?

Hi..
I've had problems with Gmail and Maps applications previously with Neophyte ROMs. In that case one of the solutions was removing the apks for these apps from with the /system/app folder of the ROM zip.
My question is:
Is it possible to add our own apks to the custom ROM so that these apks come preinstalled on the ROM when someone flashes it..in a manner, a kind of 2nd generation mod?
Is it possible to add our own system variables and settings files so that the ROM autoinstalls it on First Install? In particular, I'd like to preset my own APN file for the network.
The simple answer is yes.
The entire system folder in the zip file is written to your /system partition, with the full architecture of folders and so on, so any changes made in there will also be on the system, when it is flashed.
There is also a script file, in the META-INF folder, which you can use to run commands to delete or edit something along with the flash, whenever the zip file is flashed. This is a bit more advanced though.
edit: it is the same for the data folder of course, which folders is flashed and where to is also specified in the script file mentioned above.
Thank you!
In that case, for installation of a program like Gmail.apk or Maps.apk, would be as simple as adding the .apk to the /system/app, or would I have to include other files? Would there be dependancies in other folders?
Well the apps have their own data folder on the data partition, but this is for storing changes in settings and so on, and it should be created by the app itself on first boot just like right after you wipe the data partition/factory reset
Thanks..Got some mod modding to do!
So in case I'd want to manually uninstall/manually install an apk, what would be the steps I'd have to go through?
Would there be filesystem config files (like the older Windows versions), or a central database of entries of the likes of the Registry tables of newer Windows? How does Android go about installing a file? Like which folders and files would be modified other than /system/app and /data/app? Any common files with entries? And in case of the latter, whether it would be machine readable or plain text?

Installing Metro Apps to another drive (for SSD Users)

title says it all, you see metro apps from the window store are huge, some games even reach 200 Megabytes. I'm thinking of upgrading my computer by using an SSD instead of an HDD, however unlike my HDD, the SSD is only 120GB while my HDD is 750 GB. I could easily fill 120GB with Steam Apps, Metro Apps, Desktop Apps in less than a month.
It's possible, but it does require some work. Microsoft doesn't make this easy. You can use directory symbolic links (symlinks) to put the files on one drive (say, D: ) but have them accessible via another (say, C: ). This avoids breaking all the install paths, etc. and ensures new installations will go to the correct disk. Please note that even the biggest Metro apps are pretty small compared to the typical Steam game. You'll save a lot more space moving your Steam library over to the other drive. It's also a lot easier; you can either use the built-in Steam feature to put games in different library locations, or you can use symlinks (similar to as below, but with a whole lot less "Takeown" and similar). However, if you really want to move the WindowsApps folder, try the following steps. Be aware that in cases of mistyped commands, failure to follow instructions correctly, gremlins, or plain bad luck, it's entirely possible that this will mess something up.
You'll need an Administrator command prompt (meaning you need Admin access) to do this.
These steps assume that your C:\ drive is your SSD, and that Windows is currently installed there, and D:\ is your large data drive, where you want to move the app folder.
You may adjust the paths, especially the destination, if you want; these instructions put the "WindowsApps folder on the root of the D: drive.
First, make sure you aren't running any "Metro" apps. It may help to do these steps immediately after rebooting.
Open a Command Prompt as Administrator (you can do this by right-clicking the Start button and selecting "Command Prompt (Admin)" from the menu).
Take ownership of the WindowsApps directory:
Code:
takeown /F "C:\Program Files\WindowsApps" /A /R
Make a copy of the "C:\Program FilesWindowsApps" folder onto the new drive:
Code:
robocopy "C:\Program Files\WindowsApps" "D:\WindowsApps" /E /COPYALL /DCOPY:DAT
Make sure that the copy succeeded (no Skipped or FAILED, etc. in the summary).
Delete the original WindowsApps folder:
Code:
rmdir /S "C:\Program Files\WindowsApps"
Create the symlink:
Code:
mklink /D "C:\Program Files\WindowsApps" "D:\WindowsApps"
At this point, you should be done. Try running a Metro app to verify that it worked.
My apps won't work because of the last step. It say's
Cannot create a file when that file already exists.
Click to expand...
Click to collapse
That just means that the WindowsApps dir wasn't fully deleted. I actually recommend doing this step from the local Administrator account (disabled by default; use Computer Management -> Local Users and Groups to enable it, then log off (tap your name on the Start screen to get the log off option) and log in as Admin. That should ensure that anything using the WindowsApps dir stops, since local Admin can't run AppContainer apps.
It wont let me delete these files, im in admin mode
C:\Users\Administrator>rmdir /S "C:\Program Files\WindowsApps"
C:\Program Files\WindowsApps, Are you sure (Y/N)? y
C:\Program Files\WindowsApps\MICROS~2.135\images - Access is denied.
C:\Program Files\WindowsApps\MICROS~2.135 - Access is denied.
C:\Program Files\WindowsApps\MICROS~3.26_\LOCALC~1\CACHED~1 - Access is denied.
C:\Program Files\WindowsApps\MICROS~3.26_\LOCALC~1 - Access is denied.
C:\Program Files\WindowsApps\MICROS~3.26_ - Access is denied.
Access is denied.
Click to expand...
Click to collapse
lowridincrew said:
It wont let me delete these files, im in admin mode
Click to expand...
Click to collapse
it sounds like you nor elivated the CMD promt,you need to run the cmd prompt in elevated rights, not just logged in as administrator
click start
type cmd
right click
select run as administrator
or
Windows Key + X and select cmd prompt (administrator)
Uninstall all Apps currently installed (The registry tweak will cause errors when Apps get updated)
Regedit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\PackageRoot
Change location from "C:\Program Files\WindowsApps" to where you want them ie( "e:\WinApps")
RoyalWitCheese said:
Uninstall all Apps currently installed (The registry tweak will cause errors when Apps get updated)
Regedit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\PackageRoot
Change location from "C:\Program Files\WindowsApps" to where you want them ie( "e:\WinApps")
Click to expand...
Click to collapse
I would have thought you don't need to do this if you are using a symlink/junction
If you just manually moved the files and didn't create a link afterwards then YES you need to make this registry change
Everything seemed like it went smoothly but once I updated the main apps (mail, calendar, people, messaging) They will not open. All of the apps I installed after doing this procedure work fine, as well as Store and Bing. I tried uninstalling these apps and reinstalling to no avail. They just start to open and then close. All of the new apps are being installed in the correct "WindowsApps" folder on my D: drive so it seems to have worked. Any Ideas?
Tried to make the change in the registry but when I save it I get an error message:
"Cannot edit PackageRoot: Error writing the value's new contents."
This change seems like a logical solution but I'm not sure why I can't save the change.
I'm having trouble simply copying over the data >< I initially tried to write to a sub-folder, not the root of another drive. Both attempts to run robocopy on root and sub-folder failed giving the message:
Copying File C:\Program Files\WindowsApps\18476MPBrun.ShareMyFiles_1.4.0.0_neutral__5j38zygvezh8g\App.xaml
Access is denied.
Waiting 30 seconds...
I thought maybe I had something open so I booted up in Safe Mode with cmd prompt and still, I got the same error. Any ideas?
GoodDayToDie said:
It's possible, but it does require some work. Microsoft doesn't make this easy. You can use directory symbolic links (symlinks) to put the files on one drive (say, D: ) but have them accessible via another (say, C: ). This avoids breaking all the install paths, etc. and ensures new installations will go to the correct disk. Please note that even the biggest Metro apps are pretty small compared to the typical Steam game. You'll save a lot more space moving your Steam library over to the other drive. It's also a lot easier; you can either use the built-in Steam feature to put games in different library locations, or you can use symlinks (similar to as below, but with a whole lot less "Takeown" and similar). However, if you really want to move the WindowsApps folder, try the following steps. Be aware that in cases of mistyped commands, failure to follow instructions correctly, gremlins, or plain bad luck, it's entirely possible that this will mess something up.
You'll need an Administrator command prompt (meaning you need Admin access) to do this.
These steps assume that your C:\ drive is your SSD, and that Windows is currently installed there, and D:\ is your large data drive, where you want to move the app folder.
You may adjust the paths, especially the destination, if you want; these instructions put the "WindowsApps folder on the root of the D: drive.
First, make sure you aren't running any "Metro" apps. It may help to do these steps immediately after rebooting.
Open a Command Prompt as Administrator (you can do this by right-clicking the Start button and selecting "Command Prompt (Admin)" from the menu).
Take ownership of the WindowsApps directory:
Code:
takeown /F "C:\Program Files\WindowsApps" /A /R
Make a copy of the "C:\Program FilesWindowsApps" folder onto the new drive:
Code:
robocopy "C:\Program Files\WindowsApps" "D:\WindowsApps" /E /COPYALL /DCOPY:DAT
Make sure that the copy succeeded (no Skipped or FAILED, etc. in the summary).
Delete the original WindowsApps folder:
Code:
rmdir /S "C:\Program Files\WindowsApps"
Create the symlink:
Code:
mklink /D "C:\Program Files\WindowsApps" "D:\WindowsApps"
At this point, you should be done. Try running a Metro app to verify that it worked.
Click to expand...
Click to collapse
You need to add a line to change the file access permissions using icacls, otherwise you'll get "access is denied" when you try to copy the files.
Ah, good point. (Sorry, as I mentioned somewhere, I did this rather haphazardly...)
A possibly better way (no changing permissions, including ownership) would be to use a shell under TrustedInstaller. There are, or at least used to be, a few ways to do this... but I can't get them to work now. Anybody know of one that works on Win8 x64?
built in apps(weather, mail, maps, news) not working after update. do you know how to fix other than refresh windows? thanks
Fienamie said:
built in apps(weather, mail, maps, news) not working after update. do you know how to fix other than refresh windows? thanks
Click to expand...
Click to collapse
I solved it, at least on my Surface. I ran this from an elevated command prompt after running into Access Denied on all content in the folder:
Code:
C:\windows\system32>icacls "c:\program files\windowsapps" /grant
Administrator:(D,WDAC)
I then re-ran the rmdir command.
---------- Post added at 03:48 PM ---------- Previous post was at 03:38 PM ----------
CRAP - after all this, all of my Metro apps crash and fail to open. dammit.
looks like you have made a mistake, the apps are in windowsapps folder, while the data <say downloads or cache of an online video app> is in C:\Users\<user name>\AppData\Local\Packages. this folder will even larger.
I have tried to use junction to move some of the folders to sd card on my rt, the app can read / write, but cannot create a file.
GoodDayToDie said:
It's possible, but it does require some work. Microsoft doesn't make this easy. You can use directory symbolic links (symlinks) to put the files on one drive (say, D: ) but have them accessible via another (say, C: ). This avoids breaking all the install paths, etc. and ensures new installations will go to the correct disk. Please note that even the biggest Metro apps are pretty small compared to the typical Steam game. You'll save a lot more space moving your Steam library over to the other drive. It's also a lot easier; you can either use the built-in Steam feature to put games in different library locations, or you can use symlinks (similar to as below, but with a whole lot less "Takeown" and similar). However, if you really want to move the WindowsApps folder, try the following steps. Be aware that in cases of mistyped commands, failure to follow instructions correctly, gremlins, or plain bad luck, it's entirely possible that this will mess something up.
You'll need an Administrator command prompt (meaning you need Admin access) to do this.
These steps assume that your C:\ drive is your SSD, and that Windows is currently installed there, and D:\ is your large data drive, where you want to move the app folder.
You may adjust the paths, especially the destination, if you want; these instructions put the "WindowsApps folder on the root of the D: drive.
First, make sure you aren't running any "Metro" apps. It may help to do these steps immediately after rebooting.
Open a Command Prompt as Administrator (you can do this by right-clicking the Start button and selecting "Command Prompt (Admin)" from the menu).
Take ownership of the WindowsApps directory:
Code:
takeown /F "C:\Program Files\WindowsApps" /A /R
Make a copy of the "C:\Program FilesWindowsApps" folder onto the new drive:
Code:
robocopy "C:\Program Files\WindowsApps" "D:\WindowsApps" /E /COPYALL /DCOPY:DAT
Make sure that the copy succeeded (no Skipped or FAILED, etc. in the summary).
Delete the original WindowsApps folder:
Code:
rmdir /S "C:\Program Files\WindowsApps"
Create the symlink:
Code:
mklink /D "C:\Program Files\WindowsApps" "D:\WindowsApps"
At this point, you should be done. Try running a Metro app to verify that it worked.
Click to expand...
Click to collapse
So I can use the built in steam method to move my current installs on my pro, to my 64gb class 10 microsd card? I think I saw the place you talking about. In steam store, then view, then setting, then download tab. In there I see steam folder locations. When I press on it, it shows my current steam folder location and how much memory its used up. I have 12 installs taking up like 43gb on my Surface Pro 128gb. The only options I see in there is to "Add steam folder location" and "Remove Steam folder location".
Now how would I go about using that to move existing location of installs into my micro sd card? As far as built in steam method goes. Is it like if I make a new location those will automatically be moved there or only new installs from that point on. This mod would really help and free me up space. With steam games and metro apps, im only looking at about 22.8gb free space left. I've seen other methods of moving but afraid to mess my device up. This windows stuff seem to have more dire consequences than me taking risks with my android tablet. Pro is an expensive tablet.
Would performance still be the same once stuff moved to my SanDisk class 10 64gb card? As far as steam games go. I remember reading the class 10 card has similar speeds compared to built in ssd.
Any insight greatly appreciated.
---------- Post added at 10:36 AM ---------- Previous post was at 10:21 AM ----------
I just came across this in steam help/how to's section. Bit this doesn't really describe built in steam method. More so going into file explorer and copying/pasting.
"Moving Your Steam Installation
Warning:
It is highly recommended that you create a backup of your SteamApps folder before attempting this process. Neglecting to do so may result in a loss of all of your game content should something go wrong.
If you're low on space on the drive you have Steam installed, you can move the Steam folder to a different location. Here's an example of how to move the Steam installation between two hard drives:
1.Log out and exit Steam
2.Navigate to the folder where Steam is installed (by default: C:\Program Files\Steam\)
3.Delete all of the files and folders except the SteamApps folder and Steam.exe
4.Cut and paste your Steam folder to the new location, for example: D:\Games\Steam\
5.Launch Steam
6.Steam will briefly update and then you will be ready to play
7.All future game content will be downloaded to the new folder D:\Games\Steam\Steamapps\
"
Would that be correct?
If you use the existing steam method to install new games on the SD card you can then use the method listed in the second link to move existing installs to the new location.
I took the risk and used second method of moving everything to micro sd card. it took a while but it went through successfully. games are playing fine so far off the microsd card. and now I freed up a ton of internal ssd memory space. only thing I had to do was make a new steam shortcut in desktop. but everything works as it usually does.
im hoping if I need to free up steam space on card, I can use usual method of uninstalling. Or can I have steam reading from both locations. like lets say my memory card fills up...which I only have like 13gb left on it now. can I just add another location and use internal also or does it have to be one or the other?
also by using second method, steam will automatically now install any new games to sd card. I checked in settings and the file path points to my microsd card,
demandarin said:
I took the risk and used second method of moving everything to micro sd card. it took a while but it went through successfully. games are playing fine so far off the microsd card. and now I freed up a ton of internal ssd memory space. only thing I had to do was make a new steam shortcut in desktop. but everything works as it usually does.
im hoping if I need to free up steam space on card, I can use usual method of uninstalling. Or can I have steam reading from both locations. like lets say my memory card fills up...which I only have like 13gb left on it now. can I just add another location and use internal also or does it have to be one or the other?
also by using second method, steam will automatically now install any new games to sd card. I checked in settings and the file path points to my microsd card,
Click to expand...
Click to collapse
I forget the exact settings but it is possible to specify 2 seperate steam library file paths and then when you install an game it gives the choice which to use
SixSixSevenSeven said:
I forget the exact settings but it is possible to specify 2 seperate steam library file paths and then when you install an game it gives the choice which to use
Click to expand...
Click to collapse
It's in your settings > Downloads > Steam Library folders

[Q] cant see addons

I'm using adbfire to setup amazone fire tv stick it sideloads kodi fine, but when i use restore feature to install addons it tells me that restore is complete and i check kodi on the stick and it shows the right amount of data installed but when i startup kodi it does not show any of my addons. any help or ideas are appreciated.
Open Kodi up, Goto System>Apperance>File List > show hidden files, exit system
Now Goto system on home screen, select file manager add source, Select external storage, select andriod select data, select org.xbmc.kodi select files select kodi press ok, press ok again. Now In File Manager select addons and see if they are there.
If they are go to userdata, select database, now delete addons16.db and restart kodi. It should pick up all installed addons
This may be due to a bug in adbFire, fixed for the next release, imadder's workaround is correct. Also the backup format changed after v1.18 to one similar to the backup addon available in Kodi. Older adbFire backups will need adjustment.
Older backups can be updated pretty easily. The new format requires that all of the folders under .kodi reside in the top level of the backup folder. With the older format, the container folder had the structure Backup Folder/.kodi/userdata,addons,etc. Simply move everything under .kodi up one level then delete the .kodi folder. So the new backup will be Backup Folder/userdata,addons,etc.
jocala said:
This may be due to a bug in adbFire, fixed for the next release, imadder's workaround is correct. Also the backup format changed after v1.18 to one similar to the backup addon available in Kodi. Older adbFire backups will need adjustment.
Older backups can be updated pretty easily. The new format requires that all of the folders under .kodi reside in the top level of the backup folder. With the older format, the container folder had the structure Backup Folder/.kodi/userdata,addons,etc. Simply move everything under .kodi up one level then delete the .kodi folder. So the new backup will be Backup Folder/userdata,addons,etc.
Thankyou guys for that help and info.
Click to expand...
Click to collapse

Is it possible to install an apk directly into the file system without using ADB?

I have here a conference system that is based on Android. Since its functionality is very limited I want to try to modify the system. AFAIK there is no way to access the system configuration nor the file system through the UI of the conference system itself. And I haven't found a way to access the system using ADB yet, neither through USB nor Ethernet.
But: The whole file system is on an SD-Card, so at the moment this is the only way to modify the system.
First thing I would like to do is to change the current launcher (which is mostly an interface for doing conference calls). I located the launcher in the app folder and found the entries in the packages list/xml-file in the systems folder.
My first question is: Where is the setting stored which apk is started as the launcher at the end of the boot process?
Second thing would be of course: Installing other apk. Is that possible, only through access of the file system?`

Categories

Resources