Dir to check if folder has any *.s* file

FuzMic

DataBase Tinker
Local time
Tomorrow, 04:36
Joined
Sep 13, 2006
Messages
744
Hi guys

I want to use the following v6 codes to check if the spool folder is empty

Dir("c:\windows\system32\spool\printers\*.s*")

In winxp there is no error.
In tabloid with win10.32bit, the err from this is 52 or Bad file name or number.

I think it has something to do with admin right. Is there another way to do the test.
 
I think i just found out that we can check using FileSys with folder.files.count

ie

FS = CreateObject("Scripting.FileSystemObject")
set Folder = FS.GetFolder("C:\WhateverFolder")

if (Folder.Files.count = 0) then ' there is no file

Only question left, do i need Admin right to do this, i think no need!
 
As I suspect when i try in Win10

if (Folder.Files.count = 0)

I got err 70 Permission denied. This only happen if win10, no problem with win7 & winxp.

Before the count checking the codes are

FS = CreateObject("Scripting.FileSystemObject")
set Folder = FS.GetFolder("C:\windows\system32\spool\printers\")
 
Last edited:
Since I don't have Windows 10 but have heard a LOT about how much its security has been tightened, I would not be surprised to find that the permissions on that folder are more restrictive than in prior versions of Windows. Don't forget that you are looking at a path that leads through the system32 folder, which is one of the most important folders for all hackers. My question to you is whether you can manually open a file/directory window on the table to examine those files. If you can't do it from the GUI then the API isn't going to do any better.
 
I just thought about the quick fix to this by setting the read rights for the spool/printers folder in the security tab for the user.

Funny though: why is it that even with the only one user in the tabloid which has full admin rights, win10 does not allow this user to read the spool/printers. Is there something i missed?

I will dig into the tabloid tomorrow to see what the rights settings are for this "important!!" folder & revert. Cheerio!
 
Last edited:
Is there something i missed?

With Windows, there is ALWAYS something someone missed. Knowing that others have had trouble dealing with the changes to Win10 security won't help you solve the problem but at least you won't feel dumb about it.

Before I retired, we were trying to set up our Windows workstations for the transition from Win7 to Win10, but this was a Navy site with Dept. of Defense security rules in place. We were NOT ALLOWED to "trust" the Windows security out of the box, we HAD to tailor it for certain regulations and certain software. The Windows admin guy who was doing the prototyping was moaning and groaning and cursing Win10 every other day. He would get one thing right but then something else would go bonkers, sort of like the arcade game "Whack-a-Mole." He had been on that project to set up and test the workstations for at least 3 months before I left and he STILL hadn't gotten it right. This guy was fully certified as a Windows Sys Admin and had security certificates and other training as well, but he was going NUTS trying to fix it.

Therefore, don't blame yourself for not understanding Windows setup. Like I said, it does not solve your problem, but at least you know you aren't alone in Win10 oddities.
 
Dr Thanks for the soothing case study :)
 

Users who are viewing this thread

Back
Top Bottom