SHIFT

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

User Tools

Site Tools


doscommands
Differences

This shows you the differences between two versions of the page.

Link to this comparison view

doscommands [2013/05/18 09:30] (current)
sjoerd created
Line 1: Line 1:
 += DOS / CMD And Windows Commands =
  
 +This is a not complete overview of DOS / MsDOS / CMD commands.
 +
 +== CMD ==
 +|cmd.exe /T:0A |Gives a DOS box with a black background and bright green characters |
 +
 +== Network ==
 +|{{{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 www.website.nl |-t continues \\ -L 1450 packetsize \\ -w timeout in milliseconds |
 +|proxycfg -p |? |
 +
 +== Menu ==
 +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:
 +<code dos>
 +@echo off
 +color A
 +goto menu
 +
 +:menu
 +echo.
 +echo What do you want to do?Choose and press ENTER!
 +echo.
 +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!
 +
 +:choice
 +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
 +
 +:GWEN
 +start msiexec -i "​gw703hp1\win32\groupwise.msi"​ TRANSFORMS="​gw703hp1\win32\GwEngDefNl.mst"​ /qb+ /​promptrestart
 +goto menu
 +
 +:GWNL
 +start msiexec -i "​gw703hp1\win32\groupwise.msi"​ TRANSFORMS="​gw703hp1\win32\GwEngNlDef.mst"​ /qb+ /​promptrestart
 +goto menu
 +
 +:GWUP
 +start msiexec -i "​gw703hp1\win32\groupwise.msi"​ /qb+ /​promptrestart
 +
 +:GWREMOVE
 +start msiexec -x "​gw703hp1\win32\groupwise.msi"​ /qb+ /​promptrestart
 +goto menu
 +
 +:QUIT
 +exit
 +:end
 +</​code>​
 +
 +== Autorun.inf ==
 +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:
 +<​code>​
 +[autorun]
 +open = gwinstall.bat
 +icon = "/​Program Files/​Pstart/​icon.ico"​
 +</​code>​
 +
 +== 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
 +  gpupdate /force
 +
 +Use the msconfig command to configure Windows in one easy tool
 +  msconfig
 +
 +=== Remote Desktop Script ===
 +<code dos>
 +@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%
 +</​code>​
 +
 +=== Add User ===
 +
 +Add the user Maintenance to a system and add it to the local administrators group
 +
 +<code dos>
 +net user Maintenance Welkom01 /ADD
 +net localgroup administrators maintenance /add
 +</​code>​
 +
 += 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 [[http://​technet.microsoft.com/​en-us/​sysinternals/​default.asp|Sysinternals]] and can be downloaded [[http://​technet.microsoft.com/​en-us/​sysinternals/​bb897553.aspx|here]] .
 +
 +Once you've downloaded psexec, open a command prompt and type 
 +<​code>​
 +psexec \\computer cmd 
 +</​code>​
 +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:​
 +<​code>​
 +Psexec.exe -@ComputerList.txt Gpupdate.exe /​Target:​User /force
 +Psexec.exe -@ComputerList.txt Gpupdate.exe /​Target:​Computer /​force ​
 +</​code>​
 +
 +Of course you can substitute the gpupdate command for any command you might need to use. 
 +
 +
 +{{tag>​windows notes}}
doscommands.txt · Last modified: 2013/05/18 09:30 by sjoerd