Forum Discussion

AB21805's avatar
AB21805
Bronze Contributor
Dec 05, 2022

replacing a file using intune

Hi all,

 

I am trying to replace a file which is located on devices in 

C:\ProgramFiles\ExamWritePad\

 

 

The file is called ExamWritePadSettings.Json

 

How do I do this? I have tried a bat file: Replace .\ExamWritePadSettings.Json 'C:\ProgramFiles\ExamWritePad"

 

I have even tried: copy /Y .\ExamWritePadSettings.json %systemRoot%\ProgramFiles\ExamWritePad

 

However both dont work!

 

Any ideas

 

 

  • You could add a version file in the C:\Program Files\ExamWritePad" folder, for example, a v1.txt by adjusting the install.cmd with to this:
    Copy /y .\ExamWritePadSettings.Json "C:\Program Files\ExamWritePad"
    echo "v1" > "C:\Program Files\ExamWritePad\v1.txt"

    If you ever have to update it again, adjust the install.cmd with:
    Copy /y .\ExamWritePadSettings.Json "C:\Program Files\ExamWritePad"
    echo "v2" > "C:\Program Files\ExamWritePad\v2.txt"

    And change the detection to C:\Program Files\ExamWritePad\v2.txt
  • Using a Intune package with a install.cmd which contains this should work:
    Copy /y .\ExamWritePadSettings.Json "C:\Program Files\ExamWritePad"

    It's "C:\Program Files" and not "C:\programfiles", perhaps that's the issue? Run it as system and not as user, the user doesn't have rights in c:\program files directories by default.

     

    Perhaps you are confused with the environment variables? 

     

    ProgramFiles=C:\Program Files
    ProgramFiles(x86)=C:\Program Files (x86)

    • AB21805's avatar
      AB21805
      Bronze Contributor
      Hi Harm,
      Thank you
      What would the detention rule be?
      • You could add a version file in the C:\Program Files\ExamWritePad" folder, for example, a v1.txt by adjusting the install.cmd with to this:
        Copy /y .\ExamWritePadSettings.Json "C:\Program Files\ExamWritePad"
        echo "v1" > "C:\Program Files\ExamWritePad\v1.txt"

        If you ever have to update it again, adjust the install.cmd with:
        Copy /y .\ExamWritePadSettings.Json "C:\Program Files\ExamWritePad"
        echo "v2" > "C:\Program Files\ExamWritePad\v2.txt"

        And change the detection to C:\Program Files\ExamWritePad\v2.txt

Resources