Friday, September 24, 2004

.NET Command Prompt

This batch file allows you to do various .NET related tasks. This is useful when running under a limited user account. To do the advanced tasks you need to know the local machine administrator password. Features include:

  • Goto .NET SDK, .NET bin folder
  • Show .NET help file
  • Start Web Browser
  • Administrate folders (i.e. set permissions)
  • Administrate the computer
  • List .NET related files


@echo off
rem .NET SDK bin directory
set NetSDKBin=%NetSamplePath%bin
rem .NET bin directory
set DotNetBin=%windir%\Microsoft.NET\Framework\v1.1.4322
set PATH=%DotNetBin%;%NetSDKBin%;%PATH%
color 1f
rem goto directory as supplied (i.e. via dragging onto batch file)
cd %1
rem register doskey
doskey /insert
rem go to .NET SDK bin directory
doskey sdkdir=cd "%%NetSamplePath%%"
rem go to .NET bin directory
doskey netbin=cd "%%DotNetBin%%"
rem start Web Browser, homepage set to Google
doskey webbrowser=start
rem .NET help file
doskey dotnethelp="%%ProgramFiles%%\Common Files\Microsoft Shared\Help\dexplore.exe" /helpcol ms-help://ms.netframeworksdkv1.1
rem open Windows Explorer as admin
doskey adminc=runas /u:Administrator /env "%%ProgramFiles%%\Internet Explorer\iexplore.exe c:\\"
rem open Computer Management as admin
doskey compman=runas /u:Administrator "mmc %%windir%%\system32\compmgmt.msc"
rem list c# files
doskey listcs=dir *.cs /q /p
rem list vb files
doskey listvb=dir *.vb /q /p
rem list web files
doskey listweb=dir *.as*x /q /p
rem list assembly files (dll)
doskey listdll=dir *.dll /q /p
echo To goto .NET SDK directory, type: sdkdir
echo ----------------------------------------
echo To goto .NET bin directory, type: netbin
echo ----------------------------------------
echo To start Default Web Browser, type: webbrowser
echo ----------------------------------------------
echo To show .NET help file, type: dotnethelp
echo ----------------------------------------
echo To administrate folders (i.e. set permissions), type: adminc
echo  (type Control Panel in the Address bar to open the Control Panel)
echo -------------------------------------------------------------------
echo To administrate the computer, type: compman
echo -------------------------------------------
echo You can also list files and their owner
echo  (listcs, listvb, listweb, listdll)
echo ---------------------------------------
cmd.exe /e:on /f:on /k Title .NET 1.1 Command Prompt

Edit: Added ability to list .NET related files

No comments: