Share via

mkdir as admin

Anonymous
2017-12-19T21:24:32+00:00

I'm trying to write a batch script for Windows 7 that creates a new directory. It needs to run as admin. I'm trying this

runas /user:admin-pc\admin "mkdir "C:\Program Files\IdleMiner""

I also tried

runas /user:admin-pc\admin "cmd /c mkdir "C:\Program Files\IdleMiner""

This command:

runas /user:admin-pc\admin "cmd /c mkdir C:\Program\IdleMiner" 

works fine. But

runas /user:admin-pc\admin "cmd /c mkdir "C:\Program\IdleMiner"

does not.

I'm not sure whether this is related to the space in the folder name or the permissions of that folder.

What's the right way to do this?

Windows for home | Previous Windows versions | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2017-12-19T21:31:17+00:00

    Correction already. 

    runas /user:admin-pc\admin "cmd /c mkdir "C:\Program\IdleMiner""

    *does* work.

    Was this answer helpful?

    0 comments No comments