none
不同用户执行bat文件,一个可以,一个不行 RRS feed

  • 问题

  • 一台WIN2008 R2服务器,两个帐户,都加入了本地管理员组,对同一个bat文件执行结果不一样,一个可以正常执行,一个提示系统找不到指定路径,现在想问下,需要查看哪些配置项来确定问题所在?感谢!~
    2019年12月30日 1:11

全部回复

  • 您好,

    谢谢你的提问。

    请上传相应报错截图,以帮助更好的解决你的问题。

    此外你的bat脚本是具体实现什么功能的呢?

    关于您遇到的这个系统找不到指定路径的报错,请尝试在cmd中输入该bat脚本的完整路径进行运行试试,可能出现的情况是该bat脚本在其中一个用户的profile即c:\users\username之下。

    最好的祝福,

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    2019年12月31日 1:30
    版主
  • 感谢答复,

    截图如下,

    bat脚本如下,共3个,第一个是WMSToCSM.bat,放在D:\ETL\CRM-CSM\proc\WMS路径下,第二个是Kitchen.bat,放在D:\data-integration路径下,第三个是set-pentaho-env.bat,放在D:\data-integration下。

    cd D:\ETL\CRM-CSM\proc\WMS
    D:
    D:\data-integration\Kitchen.bat /norep /file D:\ETL\CRM-CSM\proc\WMS\job-WMSToCSM.kjb >> D:\ETL\CRM-CSM\proc\WMS\log\wms_%date:~0,10%.log
    @echo off
    setlocal
    
    set CWD=%CD%
    cd /D %~dp0
    
    REM **************************************************
    REM ** Kettle home                                  **
    REM **************************************************
     
    if "%KETTLE_DIR%"=="" set KETTLE_DIR=%~dp0
    if %KETTLE_DIR:~-1%==\ set KETTLE_DIR=%KETTLE_DIR:~0,-1%
    
    cd %KETTLE_DIR%
    
    call "%~dp0set-pentaho-env.bat"
    
    REM ******************************************************************
    REM ** Set java runtime options                                     **
    REM ** Change 512m to higher values in case you run out of memory   **
    REM ** or set the PENTAHO_DI_JAVA_OPTIONS environment variable      **
    REM ******************************************************************
    
    if "%PENTAHO_DI_JAVA_OPTIONS%"=="" set PENTAHO_DI_JAVA_OPTIONS=-Xmx512m
    
    set OPT="%PENTAHO_DI_JAVA_OPTIONS%" "-Djava.library.path=%KETTLE_DIR%\libswt\win32" "-DKETTLE_HOME=%KETTLE_HOME%" "-DKETTLE_REPOSITORY=%KETTLE_REPOSITORY%" "-DKETTLE_USER=%KETTLE_USER%" "-DKETTLE_PASSWORD=%KETTLE_PASSWORD%" "-DKETTLE_PLUGIN_PACKAGES=%KETTLE_PLUGIN_PACKAGES%" "-DKETTLE_LOG_SIZE_LIMIT=%KETTLE_LOG_SIZE_LIMIT%"
    
    REM ***************
    REM ** Run...    **
    REM ***************
    
    cd /D %CWD%
    "%_PENTAHO_JAVA%" %OPT% -jar "%KETTLE_DIR%\launcher\launcher.jar" -main org.pentaho.di.kitchen.Kitchen %*
    

    rem ---------------------------------------------------------------------------
    rem Finds a suitable Java
    rem
    rem Looks in well-known locations to find a suitable Java then sets two 
    rem environment variables for use in other bat files. The two environment
    rem variables are:
    rem 
    rem * _PENTAHO_JAVA_HOME - absolute path to Java home
    rem * _PENTAHO_JAVA - absolute path to Java launcher (e.g. java.exe)
    rem 
    rem The order of the search is as follows:
    rem 
    rem 1. argument #1 - path to Java home
    rem 2. environment variable PENTAHO_JAVA_HOME - path to Java home
    rem 3. jre folder at current folder level
    rem 4. java folder at current folder level
    rem 5. jre folder one level up
    rem 6 java folder one level up
    rem 7. jre folder two levels up
    rem 8. java folder two levels up
    rem 9. environment variable JAVA_HOME - path to Java home
    rem 10. environment variable JRE_HOME - path to Java home
    rem 
    rem If a suitable Java is found at one of these locations, then 
    rem _PENTAHO_JAVA_HOME is set to that location and _PENTAHO_JAVA is set to the 
    rem absolute path of the Java launcher at that location. If none of these 
    rem locations are suitable, then _PENTAHO_JAVA_HOME is set to empty string and 
    rem _PENTAHO_JAVA is set to java.exe.
    rem 
    rem Finally, there is one final optional environment variable: PENTAHO_JAVA.
    rem If set, this value is used in the construction of _PENTAHO_JAVA. If not 
    rem set, then the value java.exe is used. 
    rem ---------------------------------------------------------------------------
    
    if not "%PENTAHO_JAVA%" == "" goto gotPentahoJava
    set __LAUNCHER=java.exe
    goto checkPentahoJavaHome
    
    :gotPentahoJava
    set __LAUNCHER=%PENTAHO_JAVA%
    goto checkPentahoJavaHome
    
    :checkPentahoJavaHome
    if exist "%~1\bin\%__LAUNCHER%" goto gotValueFromCaller
    if not "%PENTAHO_JAVA_HOME%" == "" goto gotPentahoJavaHome
    if exist "%~dp0jre\bin\%__LAUNCHER%" goto gotJreCurrentFolder
    if exist "%~dp0java\bin\%__LAUNCHER%" goto gotJavaCurrentFolder
    if exist "%~dp0..\jre\bin\%__LAUNCHER%" goto gotJreOneFolderUp
    if exist "%~dp0..\java\bin\%__LAUNCHER%" goto gotJavaOneFolderUp
    if exist "%~dp0..\..\jre\bin\%__LAUNCHER%" goto gotJreTwoFolderUp
    if exist "%~dp0..\..\java\bin\%__LAUNCHER%" goto gotJavaTwoFolderUp
    if not "%JAVA_HOME%" == "" goto gotJdkHome
    if not "%JRE_HOME%" == "" goto gotJreHome
    goto gotPath
    
    :gotPentahoJavaHome
    echo DEBUG: Using PENTAHO_JAVA_HOME
    set _PENTAHO_JAVA_HOME=%PENTAHO_JAVA_HOME%
    set _PENTAHO_JAVA=%_PENTAHO_JAVA_HOME%\bin\%__LAUNCHER%
    goto end
    
    :gotJreCurrentFolder
    echo DEBUG: Found JRE at the current folder
    set _PENTAHO_JAVA_HOME=%~dp0jre
    set _PENTAHO_JAVA=%_PENTAHO_JAVA_HOME%\bin\%__LAUNCHER%
    goto end
    
    :gotJavaCurrentFolder
    echo DEBUG: Found JAVA at the current folder
    set _PENTAHO_JAVA_HOME=%~dp0java
    set _PENTAHO_JAVA=%_PENTAHO_JAVA_HOME%\bin\%__LAUNCHER%
    goto end
    
    :gotJreOneFolderUp
    echo DEBUG: Found JRE one folder up
    set _PENTAHO_JAVA_HOME=%~dp0..\jre
    set _PENTAHO_JAVA=%_PENTAHO_JAVA_HOME%\bin\%__LAUNCHER%
    goto end
    
    :gotJavaOneFolderUp
    echo DEBUG: Found JAVA one folder up
    set _PENTAHO_JAVA_HOME=%~dp0..\java
    set _PENTAHO_JAVA=%_PENTAHO_JAVA_HOME%\bin\%__LAUNCHER%
    goto end
    
    :gotJreTwoFolderUp
    echo DEBUG: Found JRE two folder up
    set _PENTAHO_JAVA_HOME=%~dp0..\..\jre
    set _PENTAHO_JAVA=%_PENTAHO_JAVA_HOME%\bin\%__LAUNCHER%
    goto end
    
    :gotJavaTwoFolderUp
    echo DEBUG: Found JAVA two folder up
    set _PENTAHO_JAVA_HOME=%~dp0..\..\java
    set _PENTAHO_JAVA=%_PENTAHO_JAVA_HOME%\bin\%__LAUNCHER%
    goto end
    
    :gotJdkHome
    echo DEBUG: Using JAVA_HOME
    set _PENTAHO_JAVA_HOME=%JAVA_HOME%
    set _PENTAHO_JAVA=%_PENTAHO_JAVA_HOME%\bin\%__LAUNCHER%
    goto end
    
    :gotJreHome
    echo DEBUG: Using JRE_HOME
    set _PENTAHO_JAVA_HOME=%JRE_HOME%
    set _PENTAHO_JAVA=%_PENTAHO_JAVA_HOME%\bin\%__LAUNCHER%
    goto end
    
    :gotValueFromCaller
    echo DEBUG: Using value (%~1) from calling script
    set _PENTAHO_JAVA_HOME=%~1
    set _PENTAHO_JAVA=%_PENTAHO_JAVA_HOME%\bin\%__LAUNCHER%
    goto end
    
    :gotPath
    echo WARNING: Using java from path
    set _PENTAHO_JAVA_HOME=
    set _PENTAHO_JAVA=%__LAUNCHER%
    
    goto end
    
    :end
    
    echo DEBUG: _PENTAHO_JAVA_HOME=%_PENTAHO_JAVA_HOME%
    echo DEBUG: _PENTAHO_JAVA=%_PENTAHO_JAVA%
    


    2019年12月31日 2:20