Topic: file copy to administrator profile  (Read 3474 times)

file copy to administrator profile
« on: September 05, 2014, 12:14:57 PM »

a66b

  • Jr. Chef
  • **
  • Date Registered: Oct 2013
  • Posts: 22
Hi,

I've made a .script file for a software.

I need a specific file (located into the script folder) to be present into "X:\Users\Administrator\AppData\Roaming\xxxxxx\yyyyyy" when win81se is booted.
i've tried different way with no success.

Can someone help me?

Thanks :)

Re: file copy to administrator profile
« Reply #1 on: September 05, 2014, 06:39:10 PM »

ChrisR

  • XPE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 3494
Hi,

The administrator profile does not exist at Win8.1SE build time.
The administrator account is created at logon with the files copied from X:\Users\Default to X:\Users\administrator

So, you can create or copy your files in Target\Users\Default\AppData\Roaming\xxxxxx\yyyyyy ,
it will be copied at startup in X:\Users\administratorAppData\Roaming\xxxxxx\yyyyyy

You can use this (to avoid hard coded) :
Code: [Select]
// %TargetProfilesBaseDir% = for ex: D:\Win8.1SE\Target\Win8.1SE
IniRead,%ProjectDir%\Script.Project,Settings,TargetProfilesBaseDir,%TargetProfilesBaseDir%
// %AppData% = Users\Default\AppData\Roaming
IniRead,%ProjectDir%\Script.Project,BasePath,Appdata,%AppData%

// Blank file
FileCreateBlank,%TargetProfilesBaseDir%\%AppData%\xxxxx\yyyyy
// or Copy file
FileCopy,D:\zzzzz\yyyyy,%TargetProfilesBaseDir%\%AppData%\xxxxx\yyyyy

 :smile:

Re: file copy to administrator profile
« Reply #2 on: September 06, 2014, 02:45:29 PM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
Hi,

I added info to Plugin Writing Tips
http://theoven.org/index.php?topic=473

a66b, see Macro Library section for things you may require ;) http://theoven.org/index.php?board=14.0

:turtle:

Re: file copy to administrator profile
« Reply #3 on: September 08, 2014, 12:51:22 PM »

a66b

  • Jr. Chef
  • **
  • Date Registered: Oct 2013
  • Posts: 22
Thanks for the answers.

here is the code i use based on your info:
Code: [Select]
// %TargetProfilesBaseDir% = for ex: D:\Win8.1SE\Target\Win8.1SE
IniRead,%ProjectDir%\Script.Project,Settings,TargetProfilesBaseDir,%TargetProfilesBaseDir%
// %AppData% = Users\Default\AppData\Roaming
IniRead,%ProjectDir%\Script.Project,BasePath,Appdata,%AppData%

If,Not,ExistDir,%TargetProfilesBaseDir%\%AppData%\SysDev Laboratories\ufsxpci,DirMake,%TargetProfilesBaseDir%\%AppData%\SysDev Laboratories\ufsxpci
FileCopy,%ScriptDir%\*.hbin,%TargetProfilesBaseDir%\%AppData%\SysDev Laboratories\ufsxpci,NOREC

log says:
Code: [Select]
[// %TargetProfilesBaseDir% = for ex: D:\Win8.1SE\Target\Win8.1SE]
        [Success] IniRead - [%BaseDir%\Projects\Win8.1SE\Script.Project] Section [Settings] Key [TargetProfilesBaseDir] to variable: [%TargetProfilesBaseDir%] with value [%BaseDir%\Target\Win8.1SE]
        [Info] [// %AppData% = Users\Default\AppData\Roaming]
        [Success] IniRead - [%BaseDir%\Projects\Win8.1SE\Script.Project] Section [BasePath] Key [Appdata] to variable: [%AppData%] with value [Users\Default\AppData\Roaming]
       [Failed] FileCopy - Failed to copy [%BaseDir%\Projects\Win8.1SE\Apps\HD Tasks\Recover\*.hbin] to: ["%BaseDir%\Target\Win8.1SE\Users\Default\AppData\Roaming\SysDev Laboratories\ufsxpci"]: Nom de rĂ©pertoire non valide.
       [Warning] Halt

But, when i boot winpe, the directory exist but is empty (so if it exists why do i got that error on copy?)

 :sad:


Re: file copy to administrator profile
« Reply #4 on: September 09, 2014, 07:06:12 AM »

Atari800xl

  • Code Baker
  • Sr. Chef
  • ****
  • Date Registered: Feb 2013
  • Posts: 827
Sorry, this might sound dumb, but as there are no other reactions yet:
I've only looked quickly at your code, but I noticed the spaces in the path, shouldn't you put quotes there (around the full path)?
« Last Edit: September 09, 2014, 07:06:40 AM by Atari800xl »

Re: file copy to administrator profile
« Reply #5 on: September 09, 2014, 07:34:54 AM »

a66b

  • Jr. Chef
  • **
  • Date Registered: Oct 2013
  • Posts: 22
Thanks Atari ( i had a 1040STE ;) )

I tried to double quote (#$q) the path but it 's not working.

Re: file copy to administrator profile
« Reply #6 on: September 09, 2014, 08:30:15 AM »

ChrisR

  • XPE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 3494
The addition of quotes " should be enough. Use them as soon as you have spaces.
The folder must be created before, as you did :
  If,Not,ExistDir,"xxxx xxxx",DirMake,"xxxx xxxx"
I do not see the line " IF - Directory exists" in your log!

Code: [Select]
If,Not,ExistDir,"%TargetProfilesBaseDir%\%AppData%\SysDev Laboratories\ufsxpci",DirMake,"%TargetProfilesBaseDir%\%AppData%\SysDev Laboratories\ufsxpci"
FileCopy,"%ScriptDir%\*.hbin","%TargetProfilesBaseDir%\%AppData%\SysDev Laboratories\ufsxpci",NOREC
Should work

#$q is an escape character that you can use if you have quotes in a variable, a string, a registry value (eg: "Scite.exe #$q#$p1#$q" ==> Scite.exe "%1" )
or to launches an external program with quotes in the parameters, eg:
Shellexecute,Hide,cmd.exe,"/C md #$q%TargetProfilesBaseDir%\%AppData%\SysDev Laboratories\ufsxpci#$q"

Re: file copy to administrator profile
« Reply #7 on: September 10, 2014, 09:31:22 AM »

a66b

  • Jr. Chef
  • **
  • Date Registered: Oct 2013
  • Posts: 22
all good! it's working  :smile:

thanks everybody  :great:

 

Powered by EzPortal