Loading ...
Sorry, an error occurred while loading the content.

Vim and Windows User Account Control (UAC)

Expand Messages
  • wormer
    Hello! Vim is great editor, but I have some trouble when working under normal user account and editing files in places with restricted access (like Program
    Message 1 of 8 , Dec 19, 2012
    • 0 Attachment
      Hello! Vim is great editor, but I have some trouble when working under normal
      user account and editing files in places with restricted access (like
      Program Files and etc.). Is there a way to make Vim elevate access rights
      when saving a file? I want Vim to display me the UAC dialogue where I must
      confirm the operation instead of giving me a message that write failed? Is
      there anything I can do without running Vim under administrator privilegies
      or disabling UAC?



      --
      View this message in context: http://vim.1045645.n5.nabble.com/Vim-and-Windows-User-Account-Control-UAC-tp5712690.html
      Sent from the Vim - General mailing list archive at Nabble.com.

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • ashwin sathya
      +1 ... -- Thanks & Regards, R Ashwin Sathya -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are
      Message 2 of 8 , Dec 19, 2012
      • 0 Attachment
        +1


        On Wed, Dec 19, 2012 at 3:22 PM, wormer <brdanilov@...> wrote:
        Hello! Vim is great editor, but I have some trouble when working under normal
        user account and editing files in places with restricted access (like
        Program Files and etc.). Is there a way to make Vim elevate access rights
        when saving a file? I want Vim to display me the UAC dialogue where I must
        confirm the operation instead of giving me a message that write failed?  Is
        there anything I can do without running Vim under administrator privilegies
        or disabling UAC?



        --
        View this message in context: http://vim.1045645.n5.nabble.com/Vim-and-Windows-User-Account-Control-UAC-tp5712690.html
        Sent from the Vim - General mailing list archive at Nabble.com.

        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php



        --
        Thanks & Regards,
        R Ashwin Sathya

        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Ben Fritz
        ... I m pretty sure you re stuck launching Vim with admin privileges. You might be able to hack something together with one or more of these search results:
        Message 3 of 8 , Dec 19, 2012
        • 0 Attachment
          On Wednesday, December 19, 2012 3:52:01 AM UTC-6, Boris Danilov wrote:
          > Hello! Vim is great editor, but I have some trouble when working under normal
          >
          > user account and editing files in places with restricted access (like
          >
          > Program Files and etc.). Is there a way to make Vim elevate access rights
          >
          > when saving a file? I want Vim to display me the UAC dialogue where I must
          >
          > confirm the operation instead of giving me a message that write failed? Is
          >
          > there anything I can do without running Vim under administrator privilegies
          >
          > or disabling UAC?
          >
          >
          >
          >

          I'm pretty sure you're stuck launching Vim with admin privileges.

          You might be able to hack something together with one or more of these search results:

          https://www.google.com/search?q=windows+sudo+command

          But doing that you'd need to bypass Vim's normal write mechanisms, probably with a BufWriteCmd autocmd. I think you're better off just launching Vim with admin rights, as people basically do on Linux when editing system files (using "sudo" to give root access).

          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • Christian Brabandt
          ... Also, please see this comment in my plugin SudoEdit: https://github.com/chrisbra/SudoEdit.vim/blob/master/doc/SudoEdit.txt#L143 I would be interested in
          Message 4 of 8 , Dec 19, 2012
          • 0 Attachment
            On Wed, December 19, 2012 15:33, Ben Fritz wrote:
            > On Wednesday, December 19, 2012 3:52:01 AM UTC-6, Boris Danilov wrote:
            >> Hello! Vim is great editor, but I have some trouble when working under
            >> normal
            >>
            >> user account and editing files in places with restricted access (like
            >>
            >> Program Files and etc.). Is there a way to make Vim elevate access
            >> rights
            >>
            >> when saving a file? I want Vim to display me the UAC dialogue where I
            >> must
            >>
            >> confirm the operation instead of giving me a message that write failed?
            >> Is
            >>
            >> there anything I can do without running Vim under administrator
            >> privilegies
            >>
            >> or disabling UAC?
            >>
            >>
            >>
            >>
            >
            > I'm pretty sure you're stuck launching Vim with admin privileges.
            >
            > You might be able to hack something together with one or more of these
            > search results:
            >
            > https://www.google.com/search?q=windows+sudo+command
            >
            > But doing that you'd need to bypass Vim's normal write mechanisms,
            > probably with a BufWriteCmd autocmd. I think you're better off just
            > launching Vim with admin rights, as people basically do on Linux when
            > editing system files (using "sudo" to give root access).

            Also, please see this comment in my plugin SudoEdit:
            https://github.com/chrisbra/SudoEdit.vim/blob/master/doc/SudoEdit.txt#L143

            I would be interested in Windows users experiences.

            regards,
            Christian

            --
            You received this message from the "vim_use" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          • wormer
            ... Thanks for reposting this to the mailing list. SudoEdit is exactly what I was looking for. Too bad it can t give me fancy UAC dialogue, but I don t care.
            Message 5 of 8 , Dec 23, 2012
            • 0 Attachment
              >On Wed, December 19, 2012 15:33, Ben Fritz wrote:
              >> On Wednesday, December 19, 2012 3:52:01 AM UTC-6, Boris Danilov wrote:
              >>> Hello! Vim is great editor, but I have some trouble when working under
              >>> normal user account and editing files in places with restricted access
              >>> (like
              >>> Program Files and etc.). Is there a way to make Vim elevate access
              >>> rights when saving a file? I want Vim to display me the UAC dialogue
              >>> where
              >>> I must confirm the operation instead of giving me a message that write
              >>> failed? Is there anything I can do without running Vim under
              >>> administrator
              >>> privilegies or disabling UAC?
              >>>
              >>
              >> I'm pretty sure you're stuck launching Vim with admin privileges.
              >>
              >> You might be able to hack something together with one or more of these
              >> search results:
              >>
              >> https://www.google.com/search?q=windows+sudo+command
              >>
              >> But doing that you'd need to bypass Vim's normal write mechanisms,
              >> probably with a BufWriteCmd autocmd. I think you're better off just
              >> launching Vim with admin rights, as people basically do on Linux when
              >> editing system files (using "sudo" to give root access).
              >
              >Also, please see this comment in my plugin SudoEdit:
              >https://github.com/chrisbra/SudoEdit.vim/blob/master/doc/SudoEdit.txt#L143
              >
              >I would be interested in Windows users experiences.
              >
              >regards,
              >Christian

              Thanks for reposting this to the mailing list. SudoEdit is exactly what I
              was looking for. Too bad it can't give me fancy UAC dialogue, but I don't
              care. However, I've encountered a problem using SudoEdit. First it has a
              misprint where the varialbe s:writable_file is being initialized in function
              Init (where it is written as s:writEable_file there). Then I had to use the
              following g:sudoAuthArg="/noprofile /user:Grin" in my vimrc, because my
              Administrator account is renamed.

              Then I'm getting the following output when I'm trying to save file test.vim
              with :SudoWrite test2.vim.



              It doesn't write the file and gives me an error message that file wasn't
              written in Vim.

              When I'm trying to save the file under the current filename with just
              :SudoWrite I'm getting



              This time when I return to Vim the last row says the file test.vim was
              written, but actually it is not, when I reopen it. I have no idea what is
              going wrong there, but I've thought it might be because of write != 'write'
              so I've removed quotes from 'write' in cmd file, but it doesn't look to
              change anything except that I'm getting another cmd launched because of /k
              flag. That way it doesn't write anything or give any errors with this change
              either.

              Regards,
              Boris



              --
              View this message in context: http://vim.1045645.n5.nabble.com/Vim-and-Windows-User-Account-Control-UAC-tp5712690p5712751.html
              Sent from the Vim - General mailing list archive at Nabble.com.

              --
              You received this message from the "vim_use" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php
            • Boris Danilov
              ... (like ... where ... administrator ... Thanks for reposting this to the mailing list. SudoEdit is exactly what I was looking for. Too bad it can t give me
              Message 6 of 8 , Dec 23, 2012
              • 0 Attachment
                >On Wed, December 19, 2012 15:33, Ben Fritz wrote:
                >> On Wednesday, December 19, 2012 3:52:01 AM UTC-6, Boris Danilov wrote: 
                >>> Hello! Vim is great editor, but I have some trouble when working under 
                >>> normal user account and editing files in places with restricted access (like 
                >>> Program Files and etc.). Is there a way to make Vim elevate access 
                >>> rights when saving a file? I want Vim to display me the UAC dialogue where
                >>> I  must confirm the operation instead of giving me a message that write
                >>> failed? Is there anything I can do without running Vim under administrator 
                >>> privilegies or disabling UAC? 
                >>> 
                >>
                >> I'm pretty sure you're stuck launching Vim with admin privileges. 
                >> 
                >> You might be able to hack something together with one or more of these 
                >> search results: 
                >> 
                >> 
                >> But doing that you'd need to bypass Vim's normal write mechanisms, 
                >> probably with a BufWriteCmd autocmd. I think you're better off just 
                >> launching Vim with admin rights, as people basically do on Linux when 
                >> editing system files (using "sudo" to give root access).
                >
                >Also, please see this comment in my plugin SudoEdit: 
                >
                >I would be interested in Windows users experiences. 
                >
                >regards, 
                >Christian 

                Thanks for reposting this to the mailing list. SudoEdit is exactly what I was looking for. Too bad it can't give me fancy UAC dialogue, but I don't care. However, I've encountered a problem using SudoEdit. First it has a misprint where the varialbe s:writable_file is being initialized in function Init (where it is written as s:writEable_file there). Then I had to use the following g:sudoAuthArg="/noprofile /user:Grin" in my vimrc, because my Administrator account is renamed.

                Then I'm getting the following output when I'm trying to save file test.vim with :SudoWrite test2.vim.

                >>>>>
                C:\Windows\system32\cmd.exe /c C:\Users\Boris\vimfiles\autoload\sudo.cmd "test.v
                im" C:\Users\Boris\AppData\Local\Temp\VIB9AAD.tmp write runas /noprofile /user:Grin

                C:\Program Files (x86)\Vim\vim73\keymap>SETLOCAL ENABLEEXTENSIONS

                C:\Program Files (x86)\Vim\vim73\keymap>set myfile="test.vim"

                C:\Program Files (x86)\Vim\vim73\keymap>set newcontent=C:\Users\Boris\AppData\Lo
                cal\Temp\VIB9AAD.tmp

                C:\Program Files (x86)\Vim\vim73\keymap>set mode=write

                C:\Program Files (x86)\Vim\vim73\keymap>set sudo=runas

                C:\Program Files (x86)\Vim\vim73\keymap>shift

                C:\Program Files (x86)\Vim\vim73\keymap>shift

                C:\Program Files (x86)\Vim\vim73\keymap>shift

                C:\Program Files (x86)\Vim\vim73\keymap>shift

                C:\Program Files (x86)\Vim\vim73\keymap>set params=/noprofile

                C:\Program Files (x86)\Vim\vim73\keymap>shift

                C:\Program Files (x86)\Vim\vim73\keymap>if [/user:Grin] == [] goto afterloop

                C:\Program Files (x86)\Vim\vim73\keymap>set params=/noprofile /user:Grin

                C:\Program Files (x86)\Vim\vim73\keymap>goto loop

                C:\Program Files (x86)\Vim\vim73\keymap>shift

                C:\Program Files (x86)\Vim\vim73\keymap>if [] == [] goto afterloop

                C:\Program Files (x86)\Vim\vim73\keymap>if write == 'write' (runas /noprofile /u
                ser:Grin "cmd.exe /k type C:\Users\Boris\AppData\Local\Temp\VIB9AAD.tmp >"test.
                vim"" )  else (runas /noprofile /user:Grin "cmd.exe /c type "test.vim" >C:\User
                s\Boris\AppData\Local\Temp\VIB9AAD.tmp" )
                Enter the password for Grin:
                Attempting to start cmd.exe /c type test.vim >C:\Users\Boris\AppData\Local\Temp\
                VIB9AAD.tmp as user "COMPUTERNAME\Grin" ...
                Hit any key to close this window...
                <<<<<

                It doesn't write the file and gives me an error message that file wasn't written in Vim.

                When I'm trying to save the file under the current filename with just :SudoWrite I'm getting

                >>>>>
                C:\Windows\system32\cmd.exe /c C:\Users\Boris\vimfiles\autoload\sudo.cmd "test.v
                im" C:\Users\Boris\AppData\Local\Temp\VIB9AAD.tmp write runas /noprofile /user:Grin

                C:\Program Files (x86)\Vim\vim73\keymap>SETLOCAL ENABLEEXTENSIONS

                C:\Program Files (x86)\Vim\vim73\keymap>set myfile="test.vim"

                C:\Program Files (x86)\Vim\vim73\keymap>set newcontent=C:\Users\Boris\AppData\Lo
                cal\Temp\VIB9AAD.tmp

                C:\Program Files (x86)\Vim\vim73\keymap>set mode=write

                C:\Program Files (x86)\Vim\vim73\keymap>set sudo=runas

                C:\Program Files (x86)\Vim\vim73\keymap>shift

                C:\Program Files (x86)\Vim\vim73\keymap>shift

                C:\Program Files (x86)\Vim\vim73\keymap>shift

                C:\Program Files (x86)\Vim\vim73\keymap>shift

                C:\Program Files (x86)\Vim\vim73\keymap>set params=/noprofile

                C:\Program Files (x86)\Vim\vim73\keymap>shift

                C:\Program Files (x86)\Vim\vim73\keymap>if [/user:Grin] == [] goto afterloop

                C:\Program Files (x86)\Vim\vim73\keymap>set params=/noprofile /user:Grin

                C:\Program Files (x86)\Vim\vim73\keymap>goto loop

                C:\Program Files (x86)\Vim\vim73\keymap>shift

                C:\Program Files (x86)\Vim\vim73\keymap>if [] == [] goto afterloop

                C:\Program Files (x86)\Vim\vim73\keymap>if write == 'write' (runas /noprofile /u
                ser:Grin "cmd.exe /k type C:\Users\Boris\AppData\Local\Temp\VIB9AAD.tmp >"test.
                vim"" )  else (runas /noprofile /user:Grin "cmd.exe /c type "test.vim" >C:\User
                s\Boris\AppData\Local\Temp\VIB9AAD.tmp" )
                Enter the password for Grin:
                Attempting to start cmd.exe /c type test.vim >C:\Users\Boris\AppData\Local\Temp\
                VIB9AAD.tmp as user "COMPUTERNAME\Grin" ...
                Hit any key to close this window...
                <<<<<

                This time when I return to Vim the last row says the file test.vim was written, but actually it is not, when I reopen it. I have no idea what is going wrong there, but I've thought it might be because of write != 'write' so I've removed quotes from 'write' in cmd file, but it doesn't look to change anything except that I'm getting another cmd launched because of /k flag. That way it doesn't write anything or give any errors with this change either.

                Regards,
                Boris


                On Wed, Dec 19, 2012 at 8:29 PM, Christian Brabandt <cblists@...> wrote:
                On Wed, December 19, 2012 15:33, Ben Fritz wrote:
                > On Wednesday, December 19, 2012 3:52:01 AM UTC-6, Boris Danilov wrote:
                >> Hello! Vim is great editor, but I have some trouble when working under
                >> normal
                >>
                >> user account and editing files in places with restricted access (like
                >>
                >> Program Files and etc.). Is there a way to make Vim elevate access
                >> rights
                >>
                >> when saving a file? I want Vim to display me the UAC dialogue where I
                >> must
                >>
                >> confirm the operation instead of giving me a message that write failed?
                >> Is
                >>
                >> there anything I can do without running Vim under administrator
                >> privilegies
                >>
                >> or disabling UAC?
                >>
                >>
                >>
                >>
                >
                > I'm pretty sure you're stuck launching Vim with admin privileges.
                >
                > You might be able to hack something together with one or more of these
                > search results:
                >
                > https://www.google.com/search?q=windows+sudo+command
                >
                > But doing that you'd need to bypass Vim's normal write mechanisms,
                > probably with a BufWriteCmd autocmd. I think you're better off just
                > launching Vim with admin rights, as people basically do on Linux when
                > editing system files (using "sudo" to give root access).

                Also, please see this comment in my plugin SudoEdit:
                https://github.com/chrisbra/SudoEdit.vim/blob/master/doc/SudoEdit.txt#L143

                I would be interested in Windows users experiences.

                regards,
                Christian

                --
                You received this message from the "vim_use" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php

                --
                You received this message from the "vim_use" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php
              • Christian Brabandt
                Hi Boris! ... I have only seldom access to windows, but this command should work, shouldn t it? Can you verify, that either of the commands: %sudo% %params%
                Message 7 of 8 , Dec 23, 2012
                • 0 Attachment
                  Hi Boris!

                  On So, 23 Dez 2012, Boris Danilov wrote:

                  > >On Wed, December 19, 2012 15:33, Ben Fritz wrote:
                  > >> On Wednesday, December 19, 2012 3:52:01 AM UTC-6, Boris Danilov wrote:
                  > >>> Hello! Vim is great editor, but I have some trouble when working under
                  > >>> normal user account and editing files in places with restricted access
                  > (like
                  > >>> Program Files and etc.). Is there a way to make Vim elevate access
                  > >>> rights when saving a file? I want Vim to display me the UAC dialogue
                  > where
                  > >>> I must confirm the operation instead of giving me a message that write
                  > >>> failed? Is there anything I can do without running Vim under
                  > administrator
                  > >>> privilegies or disabling UAC?
                  > >>>
                  > >>
                  > >> I'm pretty sure you're stuck launching Vim with admin privileges.
                  > >>
                  > >> You might be able to hack something together with one or more of these
                  > >> search results:
                  > >>
                  > >> https://www.google.com/search?q=windows+sudo+command
                  > >>
                  > >> But doing that you'd need to bypass Vim's normal write mechanisms,
                  > >> probably with a BufWriteCmd autocmd. I think you're better off just
                  > >> launching Vim with admin rights, as people basically do on Linux when
                  > >> editing system files (using "sudo" to give root access).
                  > >
                  > >Also, please see this comment in my plugin SudoEdit:
                  > >https://github.com/chrisbra/SudoEdit.vim/blob/master/doc/SudoEdit.txt#L143
                  > >
                  > >I would be interested in Windows users experiences.
                  > >
                  > >regards,
                  > >Christian
                  >
                  > Thanks for reposting this to the mailing list. SudoEdit is exactly what I
                  > was looking for. Too bad it can't give me fancy UAC dialogue, but I don't
                  > care. However, I've encountered a problem using SudoEdit. First it has a
                  > misprint where the varialbe s:writable_file is being initialized in
                  > function Init (where it is written as s:writEable_file there). Then I had
                  > to use the following g:sudoAuthArg="/noprofile /user:Grin" in my vimrc,
                  > because my Administrator account is renamed.
                  >
                  > Then I'm getting the following output when I'm trying to save file test.vim
                  > with :SudoWrite test2.vim.
                  >
                  > >>>>>
                  > C:\Windows\system32\cmd.exe /c C:\Users\Boris\vimfiles\autoload\sudo.cmd
                  > "test.v
                  > im" C:\Users\Boris\AppData\Local\Temp\VIB9AAD.tmp write runas /noprofile
                  > /user:Grin
                  >
                  > C:\Program Files (x86)\Vim\vim73\keymap>SETLOCAL ENABLEEXTENSIONS
                  >
                  > C:\Program Files (x86)\Vim\vim73\keymap>set myfile="test.vim"
                  >
                  > C:\Program Files (x86)\Vim\vim73\keymap>set
                  > newcontent=C:\Users\Boris\AppData\Lo
                  > cal\Temp\VIB9AAD.tmp
                  >
                  > C:\Program Files (x86)\Vim\vim73\keymap>set mode=write
                  >
                  > C:\Program Files (x86)\Vim\vim73\keymap>set sudo=runas
                  >
                  > C:\Program Files (x86)\Vim\vim73\keymap>shift
                  >
                  > C:\Program Files (x86)\Vim\vim73\keymap>shift
                  >
                  > C:\Program Files (x86)\Vim\vim73\keymap>shift
                  >
                  > C:\Program Files (x86)\Vim\vim73\keymap>shift
                  >
                  > C:\Program Files (x86)\Vim\vim73\keymap>set params=/noprofile
                  >
                  > C:\Program Files (x86)\Vim\vim73\keymap>shift
                  >
                  > C:\Program Files (x86)\Vim\vim73\keymap>if [/user:Grin] == [] goto afterloop
                  >
                  > C:\Program Files (x86)\Vim\vim73\keymap>set params=/noprofile /user:Grin
                  >
                  > C:\Program Files (x86)\Vim\vim73\keymap>goto loop
                  >
                  > C:\Program Files (x86)\Vim\vim73\keymap>shift
                  >
                  > C:\Program Files (x86)\Vim\vim73\keymap>if [] == [] goto afterloop
                  >
                  > C:\Program Files (x86)\Vim\vim73\keymap>if write == 'write' (runas
                  > /noprofile /u
                  > ser:Grin "cmd.exe /k type C:\Users\Boris\AppData\Local\Temp\VIB9AAD.tmp
                  > >"test.
                  > vim"" ) else (runas /noprofile /user:Grin "cmd.exe /c type "test.vim"
                  > >C:\User
                  > s\Boris\AppData\Local\Temp\VIB9AAD.tmp" )
                  > Enter the password for Grin:
                  > Attempting to start cmd.exe /c type test.vim
                  > >C:\Users\Boris\AppData\Local\Temp\
                  > VIB9AAD.tmp as user "COMPUTERNAME\Grin" ...
                  > Hit any key to close this window...
                  > <<<<<
                  >
                  > It doesn't write the file and gives me an error message that file wasn't
                  > written in Vim.

                  I have only seldom access to windows, but this command should work,
                  shouldn't it? Can you verify, that either of the commands:
                  %sudo% %params% "cmd.exe /k type %newcontent% >%myfile%"
                  and
                  %sudo% %params% "cmd.exe /c type %myfile% >%newcontent%"

                  works? (Please replace %sudo% by runas, %params" by you parameters for
                  runas and %myfile% and %newcontent% by the name of the file as given in
                  the commandline?

                  BTW: It might be better to solve this issue off list.

                  regards,
                  Christian
                  --
                  Zur Wahrheit führen rauhe, dunkle Bahnen,
                  Erst später erfüllt sich, was wir früh schon ahnen.
                  -- Friedrich von Bodenstedt (Mirza Schaffy)

                  --
                  You received this message from the "vim_use" maillist.
                  Do not top-post! Type your reply below the text you are replying to.
                  For more information, visit http://www.vim.org/maillist.php
                • Boris Danilov
                  ... Hello, Chris! I ve made a test directory without spaces on my C: drive to test this and executed commands %sudo% %params% cmd.exe /k type %newcontent%
                  Message 8 of 8 , Dec 23, 2012
                  • 0 Attachment
                    >>On Wed, December 19, 2012 15:33, Ben Fritz wrote:
                    >>>On Wednesday, December 19, 2012 3:52:01 AM UTC-6, Boris Danilov wrote:
                    >>>>Hello! Vim is great editor, but I have some trouble when working under
                    >>>>normal user account and editing files in places with restricted access
                    >>>>(like Program Files and etc.). Is there a way to make Vim elevate access
                    >>>>rights when saving a file? I want Vim to display me the UAC dialogue
                    >>>>where I must confirm the operation instead of giving me a message that
                    >>>>write failed? Is there anything I can do without running Vim under
                    >>>>administrator privilegies or disabling UAC?
                    >>>
                    >>> I'm pretty sure you're stuck launching Vim with admin privileges.
                    >>>
                    >>>You might be able to hack something together with one or more of these
                    >>>search results:
                    >>>
                    >>>https://www.google.com/search?q=windows+sudo+command
                    >>>
                    >>>But doing that you'd need to bypass Vim's normal write mechanisms,
                    >>>probably with a BufWriteCmd autocmd. I think you're better off just
                    >>>launching Vim with admin rights, as people basically do on Linux when
                    >>>editing system files (using "sudo" to give root access).
                    >>
                    >>Also, please see this comment in my plugin SudoEdit:
                    >>https://github.com/chrisbra/SudoEdit.vim/blob/master/doc/SudoEdit.txt#L143
                    >>
                    >>I would be interested in Windows users experiences.
                    >>
                    >>regards,
                    >>Christian
                    >
                    >I have only seldom access to windows, but this command should work,
                    >shouldn't it? Can you verify, that either of the commands:
                    >%sudo% %params% "cmd.exe /k type %newcontent% >%myfile%"
                    >and
                    >%sudo% %params% "cmd.exe /c type %myfile% >%newcontent%"
                    >
                    >works? (Please replace %sudo% by runas, %params" by you parameters for
                    >runas and %myfile% and %newcontent% by the name of the file as given in
                    >the commandline?
                    >
                    >BTW: It might be better to solve this issue off list.
                    >
                    >regards,
                    >Christian

                    Hello, Chris!

                    I've made a test directory without spaces on my C: drive to test this
                    and executed
                    commands
                    %sudo% %params% "cmd.exe /k type %newcontent% >%myfile%"
                    %sudo% %params% "cmd.exe /c type %myfile% >%newcontent%"
                    manually from the command line as you told. They both worked fine, here is the
                    listing:

                    >>>>
                    C:\test>runas /noprofile /user:Grin "cmd /k type c:\test\file.vim >C:\Users\Bor
                    is\AppData\Local\Temp\VIB6B75.tmp"
                    Enter the password for Grin:
                    Attempting to start cmd /k type c:\test\file.vim >C:\Users\Boris\AppData\Local\T
                    emp\VIB6B75.tmp as user "COMPUTERNAME\Grin" ...

                    C:\test>runas /noprofile /user:Grin "cmd /k type C:\Users\Boris\AppData\Local\T
                    emp\VIB6B75.tmp >c:\test\test3.vim"
                    Enter the password for Grin:
                    Attempting to start cmd /k type C:\Users\Boris\AppData\Local\Temp\VIB6B75.tmp >c
                    :\test\test3.vim as user "COMPUTERNAME\Grin" ...
                    <<<<

                    However I noticed that the new cmd starts in %WINDIR%\System32 and you
                    specify %myfile% as a relative name. That might be the problem. Also,
                    as I've said it looks like the value write of %mode% isn't equal to
                    'write' (with quotes) and this command doesn't write the initial file
                    as intended (I assume that was intended because by the time it prompts
                    me for password the .tmp file already contains the contents of the
                    buffer). Also, there might be problems with paths that contain spaces,
                    but let's make it work with normal directory names at first.

                    Regards,
                    Boris

                    --
                    You received this message from the "vim_use" maillist.
                    Do not top-post! Type your reply below the text you are replying to.
                    For more information, visit http://www.vim.org/maillist.php
                  Your message has been successfully submitted and would be delivered to recipients shortly.