set directory for prnmngr script

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
LVL 1
bjv211Asked:
Who is Participating?
 
hesCommented:
When you run your script
cscript %windir%\system32\prnmngr.vbs -x
0
 
hesCommented:
%windir%\system32\prnmngr.vbs
0
 
bjv211Author Commented:
can you post the whole vb?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
bjv211Author Commented:
ohhh now i get it thanks :) i was putting the directory before cscript
0
 
bjv211Author Commented:
i get his error:

Line 1
Char 9
Error  Invalid character
0
 
bjv211Author Commented:
any response on this?
0
 
hesCommented:
That error is in your prnmngr.vbs file
0
 
bjv211Author Commented:
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
 
hesCommented:
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
 
bjv211Author Commented:
oh i didnt know i could do the other option.  obviously i'm a lil lost with vbs.  is one way better?
0
 
bjv211Author Commented:
nevermind i was confusing 2 things.  i just needed to use *.bat to execute the prnmngr.vbs.  thanks for your patience
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.