SHIFT

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

User Tools

Site Tools


Sidebar

Sponsor:

Would you like to sponsor this site?
Or buy me a beer?:


Recently Changed Pages:

View All Pages
View All Q Pages


View All Tags


Sign up for Q to post comments.





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.


Terms And Conditions for Q users


Pages with comments

PageDateDiscussionTags
2019/05/01 14:08 2 Comments
2019/03/15 16:02 1 Comment
2019/03/15 16:02 1 Comment
2019/03/15 16:02 3 Comments
2017/04/20 15:28 1 Comment
2017/04/20 15:23 1 Comment
2017/04/19 14:44 1 Comment
2017/04/17 20:10 1 Comment
2017/04/17 20:07 1 Comment
2017/04/17 19:58 1 Comment
2017/04/17 19:52 1 Comment

View All Comments

doscommands

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 ?

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
 
: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

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:

[autorun]
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
gpupdate /force

Use the msconfig command to configure Windows in one easy tool

msconfig

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: 2013/05/18 09:30 by sjoerd