Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2314

BATCH - Problem mit Variablenauflösung

$
0
0

hi all,
anbei mal der Code 

echo off
cls
setlocal ENABLEDELAYEDEXPANSION

rem Variablen
set "installpath=%ProgramFiles%\Statistik"
set "mdbSRVpath=%~dp0"
set "office32reg=HKLM\SOFTWARE\WOW6432Node\Microsoft\Office"
set "office64reg=HKLM\SOFTWARE\Microsoft\Office"
set "accessreg=Access\InstallRoot\Path"
set "shortcutpath=%allusersprofile%\desktop"

for /f "delims=" %%a in ('dir "%systemdrive%\msaccess.exe" /S /Q /B ^|^ findstr /i office') do ( set "accessexe=%%a" & set "accesspath=!accessexe:~0,-13!")

goto installation

:installation
echo ### INSTALLATION ###
echo Anlage lokaler Installationsorder "%installpath%"
 md "%installpath%" >nul 2>nul
echo.
echo Kopiere Datenbank auf "%installpath%"
 if exist "%mdbSRVpath%" ( copy /Y "%mdbSRVpath%*.md*" "%installpath%" >nul 2>nul )
 for /f "delims=" %%a in ('dir "%~dp0*.mdw" /b ') do ( set "accessmdw=%%a" )
 for /f "delims=" %%a in ('dir "%~dp0*.mdb" /b ') do ( set "accessmdb=%%a" )
echo.
echo Erstelle Shortcut auf Desktop
 start "" /w "%~dp0shortcut.exe" /F:"%shortcutpath%\Statistik.lnk" /A:C /T:""%accessexe%" "%installpath%\%accessmdb%" /wkgrp "%installpath%\%accessmdw%"" /W:"%installpath%"
 goto ende

:ende
echo.
echo ### END OF SCRIPT ###

Problem ist, dass der Shortcut nicht erstellt wird.

""" und "" und "' und Überbrückung mit neuer Variable funktioniert alles nicht.

Dies funktioniert von Erstellung des Shortcuts...

start "" /w "%~dp0shortcut.exe" /F:"%shortcutpath%\Statistik.lnk" /A:C /T:""%accessexe%"

Wer ne Idee?

LG Berni


Viewing all articles
Browse latest Browse all 2314


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>