Solved

set directory for prnmngr script

Posted on 2006-11-03
11
359 Views
Last Modified: 2008-02-01
simple thing i have this script to clear all printers:

cscript prnmngr.vbs -x
 

but i cant figure out how to set the directory to systemroot\system32 so it can find prnmngr.vbs
0
Comment
Question by:bjv211
[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
  • 7
  • 4
11 Comments
 
LVL 20

Expert Comment

by:hes
ID: 17867216
%windir%\system32\prnmngr.vbs
0
 
LVL 1

Author Comment

by:bjv211
ID: 17867624
can you post the whole vb?
0
 
LVL 20

Accepted Solution

by:
hes earned 500 total points
ID: 17867689
When you run your script
cscript %windir%\system32\prnmngr.vbs -x
0
Industry Leaders: 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!

 
LVL 1

Author Comment

by:bjv211
ID: 17867775
ohhh now i get it thanks :) i was putting the directory before cscript
0
 
LVL 1

Author Comment

by:bjv211
ID: 17867806
i get his error:

Line 1
Char 9
Error  Invalid character
0
 
LVL 1

Author Comment

by:bjv211
ID: 17881873
any response on this?
0
 
LVL 20

Expert Comment

by:hes
ID: 17884034
That error is in your prnmngr.vbs file
0
 
LVL 1

Author Comment

by:bjv211
ID: 17884158
no i dont believe it is.  if i take the path out and put the vbs in the same directory as  prnmngr.vbs it runs fine.
0
 
LVL 20

Expert Comment

by:hes
ID: 17884613
Ok didn't know you are running the first in another .vbs fiel
Try this in the first .vbs

Dim fso
Dim strFolderName
Dim WshShell
set fso = CreateObject("Scripting.filesystemobject")
strFolderName = fso.GetSpecialFolder(WindowsFolder)
strFolderName = strFolderName  &  "\system32\prnmngr.vbs -x"

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run (strFolderName)

set fso = nothing
set wshShell = nothing
0
 
LVL 1

Author Comment

by:bjv211
ID: 17884696
oh i didnt know i could do the other option.  obviously i'm a lil lost with vbs.  is one way better?
0
 
LVL 1

Author Comment

by:bjv211
ID: 17884722
nevermind i was confusing 2 things.  i just needed to use *.bat to execute the prnmngr.vbs.  thanks for your patience
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

737 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