--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


Recently Changed Pages:

View All Pages

View All Tags


WIKI Disclaimer: As with most other things on the Internet, the content on this wiki is not supported. It was contributed by me and is published “as is”. It has worked for me, and might work for you.
Also note that any view or statement expressed anywhere on this site are strictly mine and not the opinions or views of my employer.

Pages with comments

View All Comments


DOS / CMD And Windows Commands

This is a not complete overview of DOS / MsDOS / CMD commands.


cmd.exe /T:0A Gives a DOS box with a black background and bright green characters


Net use j: \\servername\sharename “password” Creates a drive mapping J to \\servername\sharename with the logged in username and the given password
Net use j: /delete Deletes the drive mapping J
Net use Gives an overview of the mappings on the box
Ping –t –L 1450 –w 5000 -t continues
-L 1450 packetsize
-w timeout in milliseconds
proxycfg -p ?

This is the way to get a menu in a dos batch file. The menu in this example is used to install groupwise in a few different ways:

@echo off
color A
goto menu
echo What do you want to do?Choose and press ENTER!
echo 1 Installing English version of Groupwise 7.0.3 HP1
echo 2 Installeer Nederlandse versie van Groupwise 7.0.3 HP1
echo 3 Update Groupwise with current settings to 7.0.3 HP1
echo 4 Remove Groupwise 7
echo 5 Quit!
set /P C=[1,2,3,4,5]?
if "%C%"=="1" goto GWEN
if "%C%"=="2" goto GWNL
if "%C%"=="4" goto GWUP
if "%C%"=="4" goto GWREMOVE
if "%C%"=="5" goto QUIT
goto choice
start msiexec -i "gw703hp1\win32\groupwise.msi" TRANSFORMS="gw703hp1\win32\GwEngDefNl.mst" /qb+ /promptrestart
goto menu
start msiexec -i "gw703hp1\win32\groupwise.msi" TRANSFORMS="gw703hp1\win32\GwEngNlDef.mst" /qb+ /promptrestart
goto menu
start msiexec -i "gw703hp1\win32\groupwise.msi" /qb+ /promptrestart
start msiexec -x "gw703hp1\win32\groupwise.msi" /qb+ /promptrestart
goto menu


If you create a autorun.inf file in the root of a filesystem you can change the way your device looks and automatically start a program:

open = gwinstall.bat
icon = "/Program Files/Pstart/icon.ico"

Windows Commands

Windows Updates

Use this command to tell Windows Update to start the downloading of updates:

wuauclt /resetauthorization /detectnow

Windows Management Tools

Use the gpupdate command to update the GPO's from the AD. Use the /force switch to enforce the GPO's.

gpupdate /force

Use the msconfig command to configure Windows in one easy tool


Remote Desktop Script

@echo off
set sessie=0
if %username%==sjoerd set sessie=10.181
if %username%==wybo set sessie=10.182
if not %sessie%==0 mstsc /v:10.10.%sessie%

Add User

Add the user Maintenance to a system and add it to the local administrators group

net user Maintenance Welkom01 /ADD
net localgroup administrators maintenance /add

Execute Commands From Remote

When working in a Windows environment it could really be nice if you could perform commands on remote computers by default. You could use psexec for this, a lightweight telnet substitute that can be used to launch processes on remote Windows computers. It's originally from Sysinternals and can be downloaded here .

Once you've downloaded psexec, open a command prompt and type

psexec \\computer cmd 

where computer is the name or IP address of the remote desktop computer you are targeting. Once you've done this, you're looking at an interactive command prompt on the remote computer, and any command (like gpupdate /force) you now type will be executed on the remote machine instead of the local one. Of course, this can also be done on several computers automatically, when you use a computerlist:

Psexec.exe -@ComputerList.txt Gpupdate.exe /Target:User /force
Psexec.exe -@ComputerList.txt Gpupdate.exe /Target:Computer /force 

Of course you can substitute the gpupdate command for any command you might need to use.

You could leave a comment if you were logged in.
doscommands.txt · Last modified: 2021/09/23 22:24 (external edit)