Opsiscript copy

Antworten
MaZzEe
Beiträge: 18
Registriert: 21 Jun 2018, 18:39

Opsiscript copy

Beitrag von MaZzEe »

Guten Morgen liebes Opsi Forum,

im opsiscript kann man ja mit folgender Zeile, verschiedene Dinge vor oder nach der Installation kopieren:

[Files_copy_local]
copy "%SCRIPTPATH%\files1\$File$" C:\Program Files\xyz

Wie würde das denn im jeweiligen Benutzerverzeichnis aussehen?
Als Beispiel:
C:\Users\xyz\AppData\Roaming\xyz

Ich hab schon mehrere Sachen probiert, aber bis jetzt hat nichts geklappt.
copy "%SCRIPTPATH%\files1\$File$" C:\Users\%username%\AppData\Roaming\Docusnap
copy "%Scriptpath%\files1\$File$" "%CurrentAppdataDir%\Docusnap"
Benutzeravatar
SisterOfMercy
Beiträge: 1522
Registriert: 22 Jun 2012, 19:18

Re: Opsiscript copy

Beitrag von SisterOfMercy »

It's not that difficult, if one would have taken a look in the opsi-script manual ;)

Code: Alles auswählen

Files_install /SysNative
Files_install_AllProfiles /AllNtUserProfiles

[Files_install_64]
; Example of recursively copying some files into the installation directory:
copy -s "%ScriptPath%\files\*.*" "$InstallDir64$"

[Files_install_AllProfiles]
; Example of recursively copying some files into each user profile directory:
copy -s "%ScriptPath%\files\*.*" "%UserProfileDir%"
Also, don't use stuff like "C:\Program Files\xyz", especially without quotes.

Use one of these snippets:

Code: Alles auswählen

DefVar $InstallDir64$
Set $InstallDir64$      = "%ProgramFiles64Dir%\xyz"
or

Code: Alles auswählen

copy "%SCRIPTPATH%\files1\$File$" "%ProgramFiles64Dir%\xyz"
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Patrick89bvb
Beiträge: 44
Registriert: 05 Nov 2015, 11:26

Re: Opsiscript copy

Beitrag von Patrick89bvb »

Zunächst musst du die File-Selektion mit /AllUserProfiles deklarieren:
https://download.uib.de/opsi_stable/doc ... ript-files

und deine Pfade mit den opsi-script variabeln versehen:
https://download.uib.de/opsi_stable/doc ... st-system1

z.B:

Files_Copy /AllUserProfiles

[Files_Copy]
copy "%SCRIPTPATH%\files1\$File$" "%ProfileDir%\AppData\Roaming\Docusnap"
Benutzeravatar
SisterOfMercy
Beiträge: 1522
Registriert: 22 Jun 2012, 19:18

Re: Opsiscript copy

Beitrag von SisterOfMercy »

Patrick89bvb hat geschrieben: 25 Apr 2022, 14:29 [Files_Copy]
copy "%SCRIPTPATH%\files1\$File$" "%ProfileDir%\AppData\Roaming\Docusnap"
Not %ProfileDir%, this is something else.
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Patrick89bvb
Beiträge: 44
Registriert: 05 Nov 2015, 11:26

Re: Opsiscript copy

Beitrag von Patrick89bvb »

But this varable copy in all exciting user-profil...
hobbyist
Beiträge: 38
Registriert: 29 Mai 2018, 13:38

Re: Opsiscript copy

Beitrag von hobbyist »

Hi,
%UserProfileDir% in combination with switch /AllUserProfiles

Code: Alles auswählen

"%UserProfileDir%\AppData\Roaming\Docusnap"
Diese Konstante wird nur innerhalb von Files-Sektionen, die mit der Option /AllUserProfiles aufgerufen werden, interpretiert. Sie wird dann der Reihe nach belegt mit dem Namen des Profil-Verzeichnisses der, verschiedenen auf dem System, existierenden Nutzer.
Der Parameter /AllUserProfiles existiert seit 4.12.4.27. Noch gültig aber nicht mehr empfohlen ist das alte sysnonym /AllNTUserProfiles.
https://download.uib.de/4.2/documentati ... sercontext

In Files sections that are called with option /AllUserProfiles there is a pseudo variable
%UserProfileDir%
When the section is executed for each user that exists on a work station this variable represents the name of the profile directory of the user just treated.
The parameter /AllUserProfiles exits since 4.12.4.27. The use of the older and still working synonym /AllNTUserProfiles is discouraged.
https://download.uib.de/4.2/documentati ... anual.html



%UserProfileDir% or %CurrentProfileDir%
NT6: c:\users\%USERNAME%

whereas

%ProfileDir% :
NT6: C:\users\
MaZzEe
Beiträge: 18
Registriert: 21 Jun 2018, 18:39

Re: Opsiscript copy

Beitrag von MaZzEe »

Danke für die Hilfe. :D

Hab es hiermit umgesetzt:

Code: Alles auswählen

Files_Copy /AllUserProfiles

[Files_Copy]
copy "%SCRIPTPATH%\files1\$File$" "%UserProfileDir%\AppData\Roaming\Docusnap" 
Antworten