I have the following batch file.
@echo off
@echo Kopiere Autodesk-Profil ins Homeverzeichnis (H:\)...
@rmdir /s /q "H:\Downloads\Temp_Autodesk\Autodesk AutoCAD Map 3D 2021\"
@xcopy /s /y "%APPDATA%\Autodesk\Autodesk AutoCAD Map 3D 2021\*.*" "H:\Downloads\Temp_Autodesk\Autodesk AutoCAD Map 3D 2021\*.*"
cscript dialogfenster.vbs "AutoCAD-Einstellungen gesichert"
exit
it copies data from a path that depends on the user (user can change and must therefore be a variable) into the directory "H:\Downloads\Temp_Autodesk\Autodesk AutoCAD Map 3D 2021". now i have to convert this code into a .ps1 file. I have now tried this with the partial help of AI and have come to the following result.
> # Löscht den Ordner und alle seine Inhalte, ohne eine Bestätigung zu fordern
Remove-Item -Path "H:\Downloads\Temp_Autodesk\Autodesk AutoCAD Map 3D 2021\" -Recurse -Force -ErrorAction SilentlyContinue
# Kopiert alle Dateien und Unterordner aus dem Quellverzeichnis in das Zielverzeichnis
Copy-Item -Path "$env:APPDATA\Autodesk\Autodesk AutoCAD Map 3D 2021\*" -Destination "H:\Downloads\Temp_Autodesk\Autodesk AutoCAD Map 3D 2021\" -Recurse -Force
# Führt ein VBScript aus und zeigt möglicherweise ein Dialogfenster an
& cscript //NoLogo "dialogfenster.vbs" "AutoCAD-Einstellungen gesichert"
# Skriptende
exit
Unfortunately, this does not work properly, which is probably due to the fact that Copy-Item -Path "$env:APPDATA\Autodesk\Autodesk AutoCAD Map 3D 2021*" this part does not access the user