@ECHO OFF & CLS
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: SysNative Redirect
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Purpose: SysNative is a virtual folder visible to 32-Bit applications but not
:: visible to 64-Bit applications. This script uses SysNative to redirect scripts
:: to use native executables on when run on a 64-Bit Operating System.
:: Version: 2.1
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
REM Set script filename:
SET "_MyScript=%~n0.ps1"
REM OS Run architecture check and redirect if needed:
If "%PROCESSOR_ARCHITEW6432%"=="" (GOTO :_STANDARD) ELSE (GOTO :_SYSNATIVE)
:_SYSNATIVE
%WINDIR%\sysnative\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy bypass -file "%~dp0%_MyScript%"
REM %WINDIR%\sysnative\cscript.exe "%~dp0myscript.vbs"
REM %WINDIR%\sysnative\cmd.exe "%~dp0myscript.cmd"
GOTO :_END
:_STANDARD
powershell.exe -NoProfile -ExecutionPolicy bypass -File "%~dp0%_MyScript%"
REM cscript.exe "%~dp0myscript.vbs"
REM cmd.exe "%~dp0myscript.cmd"
GOTO :_END
:_END
REM Pause to view results:
REM ECHO.
REM ECHO Press any key to exit ...
REM PAUSE > NUL
To use it just uncomment your script language of choice (while commenting out the ones you don't want), save it as a .CMD file in the same folder with the same name as the script you want to execute and specify the .CMD file as your Command Line. It should handle the rest for you.
No comments:
Post a Comment