hen running a 32-bit application on a 64-bit Windows system, you might encounter redirections to %windir%\SysWOW64 or HKLM\Software\WOW6432Node. This is a feature of the Windows File System Redirector. To bypass this redirection and access the native system directory or registry, you can utilize sysnative

ref : Redirecteur du système de fichiers – Win32 apps | Microsoft Learn

Here’s a template for using sysnative:

Set cmddism=dism
Set cmdwusa=wusa
Set cmdpowershell=powershell
Set cmdreg=reg
Set cmdpowercfg=powercfg
Set cmdcscript=cscript
if defined PROCESSOR_ARCHITEW6432 Set cmddism=%SystemRoot%\Sysnative\cmd.exe /c Dism
if defined PROCESSOR_ARCHITEW6432 Set cmdpowershell=%SystemRoot%\sysnative\WindowsPowerShell\v1.0\powershell.exe
if defined PROCESSOR_ARCHITEW6432 Set cmdwusa=%SystemRoot%\sysnative\wusa.exe
if defined PROCESSOR_ARCHITEW6432 Set cmdreg=%SystemRoot%\sysnative\reg.exe
if defined PROCESSOR_ARCHITEW6432 Set cmdpowercfg=%SystemRoot%\Sysnative\cmd.exe /c powercfg
if defined PROCESSOR_ARCHITEW6432 Set cmdcscript=%SystemRoot%\Sysnative\cscript.exe

::You can use the variables (Use sysnative for 32-bit processes.)
%cmdreg% add HKLM\Software\leblogosd ...
%cmdpowershell% -command ...
%cmddism% /add-driver ...

%cmdpowershell% -noprofile -command "Set-ExecutionPolicy bypass LocalMachine"
%cmdpowershell% -file "%~dp0script.ps1"

This script sets up various command variables and then checks if the current process is a 32-bit process running on a 64-bit system. If it is, it modifies the command variables to use the sysnative path, ensuring that the commands run in the native 64-bit environment.


0 commentaire

Laisser un commentaire

Emplacement de l’avatar

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.