Solved

VBScript to uninstall app with command line switch

Posted on 2011-09-07
3
737 Views
Last Modified: 2012-05-12
I am trying to build a GPO which will run a vbscript at login on users Windows XP machines with Client Side Extensions installed.

In the script, I seach to see if the uninstall.exe is there and if so, then I try and run the following:

WshShell.Run ("%comspec% /c c:\progra~1\spark\uninstall.exe -q")

I try and run with %comspec% so I can use command line switches.  The vbscript, when run outside of the login script seems to work but if I try and run it via a login script, users get the following and the app will not run:

"CMD.EXE was started with the above path as the current directory. UNC paths are not supported. Defaulting to Windows directory"

I am not stuck on using comspec but I am really looking for a way to utilize the login script to run the uninstall.exe with the -q command line option.

Any assistance is appreciated.
0
Comment
Question by:TexasPlowBoy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Expert Comment

by:Crower
ID: 36497276
you can create a bat in the path where the CMD starts. within the batch file you run all the statements you need. such as changing unit, launch an exe, etc. ..
0
 
LVL 13

Expert Comment

by:khairil
ID: 36497870
Hi,

Why not just write it this way?

set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run ("cmd.exe /c c:\progra~1\spark\uninstall.exe -q")

Open in new window


I don't think you need to run full c:\windows\system\cmd.exe /c... for your command.

Comspec will always called CMD.EXE in Windows 2000 above, and access to CMD.EXE basically already declare on PATH variables.

0
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 36499936
The fact that it defaults to the windows directory shouldn't matter either.  It should still run the uninstall command.

I think to avoid that, you can change the current directory of the script before running the command.

Regards,

Rob.
Set objShell = CreateObject("WScript.Shell")
objShell.CurrentDirectory objShell.ExpandEnvironmentStrings("%WINDIR%") & "\System32"
intReturn = objShell.Run("%comspec% /c c:\progra~1\spark\uninstall.exe -q", 1, True)

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In-place Upgrading Dirsync to Azure AD Connect
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question