none
[BATCH] MsiExec doesn't handle special folders '.' and '..' RRS feed

  • Question

  • Hi,

    I have a strange thing on 2 Windows 7 computers (not even tried on Windows 10).

    When using a full path containing a '.' or '..' folder, the application fails to install the product but Inside the BATCH, all is working.

    Let's have a look to my POC code :

    @echo OFF
    cls
    echo [Initialisation]
    setlocal enabledelayedexpansion
    
    set g_strBatchPath=%~dp0
    set g_strCurrentDirectory=%CD%
    set strLibreOfficeVersion=5.4.1.2
    
    echo Batch path    : %g_strBatchPath%
    echo Current path  : %g_strCurrentDirectory%
    
    rem NON WORKING 
    set strMsiFile=H:\_Maintenance\.\repository\LibreOffice_%strLibreOfficeVersion%_Win_x86.msi
    
    rem WORKING 
    rem set strMsiFile=H:\_Maintenance\repository\LibreOffice_%strLibreOfficeVersion%_Win_x86.msi
    
    echo %strMsiFile%
    if EXIST "%strMsiFile%" (
    	echo MSI OK : %strMsiFile%
    )
    
    msiexec /i "%strMsiFile%" /log "%TEMP%\Nolme_MsiExe.log"
    
    
    Pause

    - The file presence check is working well Inside BATCH.

    - I was able to reproduce the problem on 2 computers (full updates)

    Does soemone have the same problem ?

    Vincent

    Saturday, September 23, 2017 10:21 PM

All replies

  • Hi,

    It can’t create a folder named “.” and “..” in Windows. I try to create and rename the folder, and get following screenshots.

    And I try to create a folder that name contain “.”, and  get following screenshot. So a folder name ending with a dot is not allowed.

    Here is a link about Filename for your reference.

    Filename:

    https://msdn.microsoft.com/en-us/library/windows/desktop/aa368590(v=vs.85).aspx


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

    Monday, September 25, 2017 9:16 AM
  • in this (POC) case, '.' is used for designing current folder. I've found this problem in a production script which use '..' to go to parent folder.
    Tuesday, September 26, 2017 5:58 PM
  • Please post this question on script forum. There will give you better advice.

    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?category=scripting

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.


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

    • Proposed as answer by Vera Hu Tuesday, October 31, 2017 10:49 AM
    Wednesday, September 27, 2017 9:50 AM