Batch script to copy/create file/folder in AppData
Verfasst: 27 Okt 2017, 15:44
Hello,
Do you know if it is possible to copy or move a file to C:\Users\Username\AppData\Roaming through OPSI ?
I have tried using the OPSI command (winst) copy with parameter 's' and also without parameter, but impossible. I cannot manage with a Dos batch too (by asking OPSI to execute the batch).
What is the exact variable I should use (Windows variable/value): %appdatadir% or %CurrentAppdataDir% ?
If I use Dos commands, do I have to use %appdata% or still using OPSI variable integrated to my Dos commands (%appdatadir% or %CurrentAppdataDir%) ?
It seems impossible to ask OPSI to make any action in C:\Users\Username\AppData\Roaming
Here is a part of my script:
[Files_install_1]
; Example of recursively copying some files into the installation directory:
copy "%ScriptPath%\spark.bat" "%ProgramFiles32Dir%\"
copy "%ScriptPath%\spark.properties" "%ProgramFiles32Dir%\"
[Registry_install]
; Example of setting some values of an registry key:
;
openkey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Search\UsnNotifier\Windows\Catalogs\SystemIndex]
set "{1337E3EF-24E8-11E7-B165-806E6F6E6963}" = REG_DWORD:11169827240
; set "name2" = REG_DWORD:0001
; set "name3" = REG_BINARY:00 af 99 cd
[DOSInAnIcon_1]
; Commandes batch de Windows (sans affichage de l'invite de commandes)
cd %ProgramFiles32Dir%
spark.bat
;[Files_install_2]
; Example of recursively copying some files into the installation directory:
; copy -s "%ScriptPath%\spark.properties" "%AppDataDir%\Spark\"
Thanks for your help.
Siming
Do you know if it is possible to copy or move a file to C:\Users\Username\AppData\Roaming through OPSI ?
I have tried using the OPSI command (winst) copy with parameter 's' and also without parameter, but impossible. I cannot manage with a Dos batch too (by asking OPSI to execute the batch).
What is the exact variable I should use (Windows variable/value): %appdatadir% or %CurrentAppdataDir% ?
If I use Dos commands, do I have to use %appdata% or still using OPSI variable integrated to my Dos commands (%appdatadir% or %CurrentAppdataDir%) ?
It seems impossible to ask OPSI to make any action in C:\Users\Username\AppData\Roaming
Here is a part of my script:
[Files_install_1]
; Example of recursively copying some files into the installation directory:
copy "%ScriptPath%\spark.bat" "%ProgramFiles32Dir%\"
copy "%ScriptPath%\spark.properties" "%ProgramFiles32Dir%\"
[Registry_install]
; Example of setting some values of an registry key:
;
openkey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Search\UsnNotifier\Windows\Catalogs\SystemIndex]
set "{1337E3EF-24E8-11E7-B165-806E6F6E6963}" = REG_DWORD:11169827240
; set "name2" = REG_DWORD:0001
; set "name3" = REG_BINARY:00 af 99 cd
[DOSInAnIcon_1]
; Commandes batch de Windows (sans affichage de l'invite de commandes)
cd %ProgramFiles32Dir%
spark.bat
;[Files_install_2]
; Example of recursively copying some files into the installation directory:
; copy -s "%ScriptPath%\spark.properties" "%AppDataDir%\Spark\"
Thanks for your help.
Siming