Sometimes you need to run an executable as a different user via command prompt:
- in scripts
- in Windows 2008 (not 2008 R2), you cannot use shift right click to "run as different user"
Windows come with a command line tool called "runas", which allow users to execute anything as a different user, in the following syntax
runas /user domain\username "full path to exe"
ie.
runas /user domain\username "c:\temp\temp.exe /a /l /r"
Showing posts with label command prompt. Show all posts
Showing posts with label command prompt. Show all posts
Wednesday, November 23, 2011
Saturday, September 3, 2011
Removing Empty Folders In Command Prompt
For a quick way to batch remove all empty folders, "cd" into that folder and perform the following:
for /f "usebackq delims=" %d in (`"dir /ad/b/s | sort /R"`) do rd "%d"
Please backup the source folder before doing so, just in case. Afterwards, you can use beyond compare and order by folder size to compare the results.
for /f "usebackq delims=" %d in (`"dir /ad/b/s | sort /R"`) do rd "%d"
Please backup the source folder before doing so, just in case. Afterwards, you can use beyond compare and order by folder size to compare the results.
Subscribe to:
Posts (Atom)