Minor update to the WSS Command Prompt…


 

Take the following and paste into a VBS file – then run.

Still need to choose the Link, then set the “Run as administrator” when UAC is on…

 

Set Shell = CreateObject("WScript.Shell") 
Set Env = Shell.Environment("PROCESS") 
DesktopPath = Shell.SpecialFolders("Desktop") 
Set link = Shell.CreateShortcut(DesktopPath & "\WSS CMD.lnk") 

cssHive = Env("CommonProgramFiles") & "\Microsoft Shared\web server extensions\12" 
currentPath = RTrim(Replace(WScript.ScriptFullName, WScript.ScriptName, "")) 
envBatFile = "setWssPath.cmd" 

CreateBatFile currentPath & setWssPath & envBatFile, cssHive 

link.Arguments = "/k " & " " & Chr(34) & currentPath & envBatFile & Chr(34) 
link.Description = "WSS Command Prompt" 
link.HotKey = "CTRL+SHIFT+W" 
link.IconLocation = "%SystemRoot%\system32\SHELL32.dll,94" 
link.TargetPath = "%comspec%" 
link.WindowStyle = 1 
link.WorkingDirectory = cssHive 
link.Save 
Sub CreateBatFile(fileName, cssHive) 
    Set fso = CreateObject("Scripting.FileSystemObject") 
    Set file = fso.CreateTextFile(fileName, True) 
    file.WriteLine("@SET PATH=%PATH%;" & cssHive & "\bin") 
    file.WriteLine("@ECHO WSS CMD Shell - Shawn Cicoria") 
    file.WriteLine("CD " & cssHive)

End Sub
Comments (2)

  1. mcnga1 says:

    I don’t know if the following will be formatted and readable, but I use the Sysinternals PSEXEC program to accomplish something similar:

    @echo off

    setlocal

    set PSEXEC=”c:Program Filessysinternalspsexec.exe”

    set USR=SPAccount

    set PWD=password

    set CWD=%CD%

    %PSEXEC% -accepteula -d -u %USR% -p %PWD% cmd.exe /K “title Command Prompt – %USR% && cd /d %CWD%”

  2. The purpose of the "WSS" command prompt is to have it PATH’d to the SharePointBIN path so you can just run STSADM.exe commands, etc.  It also changes the path to the "12" hive so you’re not CD’ing all over the place.

    I don’t see how PSEXEC elevates (UAC) in this manner.  That command will launch a CMD with a special title, but doesn’t acomplish what I was trying to get done via the WSS Command prompt shortcut.