Posts Tagged ‘MS-DOS’
(long tweet) Run MS-DOS command as super user
How to run a MS-DOS command terminal with administrator priviledges, in Windows 7?
Let’s say you need execute cmd
with the account admin
: launch runas /user:admin cmd
.
Windows will ask you to enter the admin password and then will open a CMD
prompt in admin mode.
Equivalent of ‘ps’ in MS-DOS
What is the equivalent of Unix’ ps
in MS-DOS, to be used in a .BAT
script?
Let’s use %tasklist%
.
eg:
[java]tasklist /fi "IMAGENAME eq java.exe" /FI "MEMUSAGE gt 100000"
Image Name PID Session Name Session# Mem Usage
========================= ====== ================ ======== ============
java.exe 9972 Console 0 212,932 K
java.exe 9640 Console 0 219,328 K
java.exe 11040 Console 0 213,432 K
java.exe 11144 Console 0 214,232 K\[/java]
Equivalent of ‘pwd’ in MS-DOS
What is the equivalent of Unix’ pwd
in MS-DOS, to be used in a .BAT
script?
Let’s use %CD%
.
eg:
[java]C:\cd "C:\Documents and Settings"
C:\Documents and Settings>set FOO=%CD%
C:\Documents and Settings>>echo Hello my folder: %FOO%
Hello my folder: C:\Documents and Settings\[/java]
Copy recursively a folder in MS-DOS
Abstract: we need copy all Java files in a folder and its subdirectories.
Solution:
xcopy C:\<source folder>\*.java C:\<destination folder>\
Create an alias in MS-DOS
Here is a very useful way to retrieve UNIX’customs in DOS: creating aliases. For instance, you can type this:
doskey ls=dir