How to copy paste files via Intune problem with environment variables on Windows 11

N-M 191 Reputation points
2023-04-12T20:50:32.9366667+00:00

Hello, I need to copy paste a file in download folder foe some users through Intune. I know I can do it through APP-> windows app(win 32) according to this tutorial "https://www.youtube.com/watch?v=k8WQbjlajlQ"

I created a bat file with following command: copy testfile.txt C:\Users%USERNAME%\Downloads /y

It seems windows app(win 32) has problem with environment variables on Windows. So, C:\Users%USERNAME%\Downloads do not work for me. I used %USERPROFILE% as well and it didn't work as well.

copy testfile.txt %USERPROFILE%\Downloads /y If I use this command copy testfile.txt C:\Users\jack\Downloads /y

it will work. I am sure the bat file that I created is ok because it is working when I run it, but with Intune nope. It would be great if you could help me in this regard. Thank you in advance!

Microsoft Security | Intune | Other
0 comments No comments
{count} votes

Accepted answer
  1. Simon Ren-MSFT 40,341 Reputation points Microsoft External Staff
    2023-04-13T02:30:55.19+00:00

    Hi,

    Thank you for posting in Microsoft Q&A forum.

    1,What is the install behavior for your app in program page, to User or System? If it is to System, please change the install behavior to User in program page to have a try.

    2,Please also try the install command some like below:

    cmd.exe /c ".\copy.cmd"

    A helpful similar thread:

    https://www.reddit.com/r/Intune/comments/l7um0v/deploying_files_via_intune/

    Note: This is non-Microsoft link, just for your reference. Thanks for your time. Have a nice day!

    Best regards,
    Simon


    If the response is helpful, please click "Accept Answer" and upvote it. Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. N-M 191 Reputation points
    2023-04-13T15:11:27.2533333+00:00

    Thank you. User mode worked for me.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.