Programmverzeichnis auswählen per Batchdatei
Hallo, ich habe versucht bei unseren Startup-Scripten ein Programm auszuführen. Das Programm ist ein 32bit Programm wird also unter C:\Programme respektive C:\Programme (x86) gespeichert. Um nun das Programm richtig zu starten, bastel ich mir den Pfad zusammen, wie unten zu sehen. Dies funktioniert auf 64bit Kisten auch wunderbar, auf 32bit Rechnern bleibt aber der %programfiles% teil leer, so dass der Pfad mit \OCS Inventory anfängt. Bin ich blind und habe nen Typo in der Batchdatei oder ist das ein bekannter Fehler?
if "PROCESSOR_ARCHITECURE"=="AMD64" GOTO AMD64
if "PROCESSOR_ARCHITECURE"=="x86" GOTO x86
:AMD64
set "ocs=%PROGRAMFILES(x86)%\OCS Inventory Agent\OCSInventory.exe"
GOTO OCS
:x86
set "ocs=%PROGRAMFILES%\OCS Inventory Agent\OCSInventory.exe"
GOTO OCS
:OCS
"%ocs%"
if "PROCESSOR_ARCHITECURE"=="AMD64" GOTO AMD64
if "PROCESSOR_ARCHITECURE"=="x86" GOTO x86
:AMD64
set "ocs=%PROGRAMFILES(x86)%\OCS Inventory Agent\OCSInventory.exe"
GOTO OCS
:x86
set "ocs=%PROGRAMFILES%\OCS Inventory Agent\OCSInventory.exe"
GOTO OCS
:OCS
"%ocs%"
Please also mark the comments that contributed to the solution of the article
Content-ID: 100967
Url: https://administrator.de/forum/programmverzeichnis-auswaehlen-per-batchdatei-100967.html
Printed on: May 13, 2025 at 13:05 o'clock
3 Comments
Latest comment