Saving to root directory of windows 7
1 次查看(过去 30 天)
显示 更早的评论
Hi there.
I have a matlab function that saves using fprintf...and it works just fine saving anywere, exept I can't save in the root, that is 'c:\' which is exactly where it needs to be saved. I can ofcourse save it somewhere else and then copy it to the root and say 'yes' or whatever when windows as me for persmission and admin rights and so on...
but I NEED to code it so that matlab saves it to "c:\filename".
which brings me to my question, is there anyway to get matlab to tell windows to ask for the admin rights when trying to save the file? that is via coding...
2 个评论
Daniel Shub
2011-5-21
As a Linux user, I am not sure I can be much help. First, are you sure you need to save it to the root directory? Second, can you run MATLAB as root for this case?
采纳的回答
Johan
2011-5-26
3 个评论
Jason Ross
2011-5-26
Yes, I have traveled the same road ... on some level you might consider it "job security" since you know they'll be back in the future :)
更多回答(1 个)
Walter Roberson
2011-5-21
Perhaps you could system() a runas command that copies the file to where it needs to go. I seem to recall that runas prompts for the password.
2 个评论
Walter Roberson
2011-5-22
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/runas.mspx?mfr=true
It would simply be a Windows command-line that you submitted via system()
system(sprintf('runas /user:Administrator@YourComputerName move %s %s', oldfilename, newfilename))
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!