Recipe4hate
Legacy Member
Hoi allemaal,
Zouden jullie me kunnen uitleggen waarom volgend script niet werkt op Windows 7?
Ik wil dus 2 database file kopieren van een locatie naar de %temp%.
Indien de Front bestaat, overschrijf deze. Indien de Calc bestaat, overschrijf deze niet.
De CMD loopt mooi door tot aan het punt waar het systeem vraagt of hij de commands in het script mag runnen. Hier zegt hij ofwel 'incorrect syntax', ofwel runt hij de commands sowieso (ook als ik N
ingeef).
Ik vermoed dat het iets te maken heeft met deze IF (ofwel de haakjes erbij die niet correct zijn) ofwel de SET /P die niet goed werkt...
Iemand een idee? Ik heb zo het vermoeden dat Shell onder WIN7 bijzonder buggy is. Soms werkt het wel, wissel ik dan een block van plaats, werkt het plots niet meer?
Alvast hartelijk dank!
Zouden jullie me kunnen uitleggen waarom volgend script niet werkt op Windows 7?
Code:
::This tool will copy the carrier performance database to the local system and run it from there
@echo off
setlocal
::BASE DEF
CLS
COLOR 1F
::VAR DEF
SET sSourcePath=K:\CSR\Carrier Performance\
SET sDestPath=%TEMP%\
SET sFN=Carrier Performance Front.mdb
set sFNCalc=Carrier Performance PerformanceCalcTables.mdb
::TEST
SET sTestMode=Y
::SET sTestMode=Y or N -> user choice
::BASE INFO
ECHO %sSourcePath%
ECHO %sFN%
ECHO %sDestPath%
ECHO -
ECHO %sSourcePath%%sFN%
ECHO %sDestPath%%sFN%
ECHO -
ECHO %sSourcePath%%sFNCalc%
ECHO %sDestPath%%sFNCalc%
ECHO 0: %0
ECHO 1: %1
ECHO.
ECHO.
IF %sTestMode%==Y PAUSE
GOTO Test
:Test
ECHO.
ECHO.
ECHO *************************
ECHO Testing base info
ECHO *************************
ECHO Source path variable definition: (sSourcePath) = %sSourcePath%
ECHO Destination path variable definition: (sDestPath) = %sDestPath%
ECHO File Name definition: (sFN) = %sFN%
ECHO Calc File Name definition: (sFNCalc) = %sFNCalc%
ECHO.
ECHO.
ECHO *************************
ECHO Doing checks
ECHO *************************
IF EXIST "%sSourcePath%%sFN%" ECHO Source path and file exists
IF EXIST "%sDestPath%%sFN%" ECHO Destination path and file exists
IF EXIST "%sSourcePath%%sFNCalc%" ECHO Source path and file exists
IF EXIST "%sDestPath%%sFNCalc%" ECHO Destination path and file exists
IF NOT EXIST "%sSourcePath%%sFN%" ECHO Source path and file doesn't exist
IF NOT EXIST "%sDestPath%%sFN%" ECHO Destination path and file doesn't exist
IF NOT EXIST "%sSourcePath%%sFNCalc%" ECHO Source path and file doesn't exist
IF NOT EXIST "%sDestPath%%sFNCalc%" ECHO Destination path and file doesn't exist
ECHO.
ECHO.
ECHO Checks complete
ECHO *************************
ECHO.
IF NOT %sTestMode%==Y GOTO RUNCMDS
IF %sTestMode%==Y (
ECHO Do you want to run the commands in this script?
SET /P sCMD=Enter value (Y/N)
)
IF %sCMD%==Y GOTO RUNCMDS
IF %sCMD%==y GOTO RUNCMDS
IF %sCMD%==YES GOTO RUNCMDS
IF %sCMD%==Yes GOTO RUNCMDS
IF %sCMD%==yes GOTO RUNCMDS
:RUNCMDS
IF %sTestMode%==Y CLS
ECHO.
ECHO *****************************************
ECHO Copying "%sSourcePath%%sFN%"
ECHO To "%sDestPath%%sFN%"
ECHO ****************************************
ECHO.
COPY /Y "%sSourcePath%%sFN%" "%sDestPath%%sFN%"
ECHO.
ECHO.
ECHO.
ECHO *****************************************
IF EXIST "%sDestPath%%sFNCalc%" (
ECHO Calc file not copied to maintain DB integrity.
ECHO Already exists.
ECHO *****************************************
)
IF NOT EXIST "%sDestPath%%sFNCalc%" (
ECHO Copying "%sSourcePath%%sFNCalc%"
ECHO To "%sDestPath%%sFNCalc%"
ECHO *****************************************
COPY /Y "%sSourcePath%%sFNCalc%" "%sDestPath%%sFNCalc%"
)
ECHO.
ECHO.
ECHO.
ECHO *****************************************
ECHO Running "%sDestPath%%sFN%"
START "Performance" /REALTIME "%sDestPath%%sFN%"
ECHO *****************************************
GOTO END
:End
ECHO.
ECHO.
ECHO Goodbye.
Ik wil dus 2 database file kopieren van een locatie naar de %temp%.
Indien de Front bestaat, overschrijf deze. Indien de Calc bestaat, overschrijf deze niet.
De CMD loopt mooi door tot aan het punt waar het systeem vraagt of hij de commands in het script mag runnen. Hier zegt hij ofwel 'incorrect syntax', ofwel runt hij de commands sowieso (ook als ik N
ingeef).
Ik vermoed dat het iets te maken heeft met deze IF (ofwel de haakjes erbij die niet correct zijn) ofwel de SET /P die niet goed werkt...
Iemand een idee? Ik heb zo het vermoeden dat Shell onder WIN7 bijzonder buggy is. Soms werkt het wel, wissel ik dan een block van plaats, werkt het plots niet meer?
Alvast hartelijk dank!