2

I am running assoc from an administrative command prompt

I'd like to add an entry for .vbsc in my list of associations. It won't let me, Though it will let me do one for .vbsd And it is running assoc. (if it wasn't finding assoc it'd say it's not recognized). So what's going on?

I do have a program(a wrapper for cscript.exe) that I wrote that I have linked to .vbsc files, it does attach, though as you see from the grep, it doesn't get listed listed in assoc for some reason, which is an oddity, but the oddity i'm asking about here(which may be related), is why does assoc .vbsc= on my machine say "The system cannot find the file specified"?

C:\>assoc .vbsc=  <--- fails, i'd expect it to work
The system cannot find the file specified.

C:\>assoc .abc=  <-- works, no error

C:\>assoc .abcd= <-- works, no error

C:\>assoc .vbsd=  <-- works, no error

C:\>

and for a reminder of what it shown when a command isn't recognized.

C:\>hjghjgjhgjh
'hjghjgjhgjh' is not recognized as an internal or external command,
operable program or batch file.

C:\>

and more info

C:\>assoc | grep -i vbs
.vbs=VBSFile

C:\>ftype | grep -i vbs
VBSFile=C:\blah\mycscriptwrapper.exe %1
VBS_Cscr=C:\blah\mycscriptwrapper.exe %1

C:\>

added clarification

and if anybody finds the above rather hard to understand with the arrows and descriptions, and prefers no english and just a screenshot, here is a link to such a screenshot, it shows just the main part of what is above.

enter image description here

and it gets stranger.

enter image description here

Jozef has suggested something which I think might essentially be the breakthrough. Doing reg query hkcr\.vbsc and with /s. Comparing that with .abc shows differences.

UPDATE I will merge this into jozef's answer.. but here temporarily as a record.

    C:\Users\harvey>reg query hkcr\.vbsc

    HKEY_CLASSES_ROOT\.vbsc\OpenWithList
    HKEY_CLASSES_ROOT\.vbsc\PersistentHandler
    HKEY_CLASSES_ROOT\.vbsc\Shell

    C:\Users\harvey>reg query hkcr\.vbsc  /s

    HKEY_CLASSES_ROOT\.vbsc\OpenWithList

    HKEY_CLASSES_ROOT\.vbsc\PersistentHandler
        OriginalPersistentHandler    REG_SZ    {00000000-0000-0000-0000-000000000000
    }

    HKEY_CLASSES_ROOT\.vbsc\Shell

    HKEY_CLASSES_ROOT\.vbsc\Shell\Open

    HKEY_CLASSES_ROOT\.vbsc\Shell\Open\Command
        (Default)    REG_EXPAND_SZ    VBS_Cscr


    C:\Users\harvey>

with .abc, even with

assoc abc=RAZ

(and even with ftype set it's still only this for .abc )

C:\Users\harvey>reg query hkcr\.abc

HKEY_CLASSES_ROOT\.abc
    (Default)    REG_SZ    RAZ


C:\Users\harvey>

with ftype set you also get this key 

ftype RAZ=c:\blah\blah.exe

C:\Users\harvey>reg query hkcr\RAZ /s

HKEY_CLASSES_ROOT\RAZ\Shell

HKEY_CLASSES_ROOT\RAZ\Shell\Open

HKEY_CLASSES_ROOT\RAZ\Shell\Open\Command
    (Default)    REG_EXPAND_SZ    c:\blah\blah.exe


C:\Users\harvey>

C:\Users\harvey>reg delete hkcr\.vbsc
Permanently delete the registry key HKEY_CLASSES_ROOT\.vbsc (Yes/No)? y
The operation completed successfully.

and now it works.. no idea how those other entries got there.. possibly a mix of 'default programs editor' and start.."change the file type associated with a specific extension" and making a .vbsc icon and choosing a program with open with, and assoc.

enter image description here

  • 1
    'assocc' is not recognized but assoc works… See typo in the first assocc (note doubled c) – JosefZ May 2 '16 at 7:41
  • @JosefZ I would downvote your comment if I could. You have not understood my question or the reason why I wrote that example of 'assocc' with the typo, and you are wrong to say that assoc is working(see the first line and you see assoc giving a strange error). My point was to show what error message you get if you type a command that doesn't exist. I will change that example though to make it clearer. And assoc is clearly not working right, see the very first line where I executed assoc and got that error. – barlop May 2 '16 at 14:55
  • Sorry if you think that anybody merits punishment for misunderstanding wrongly formulated question. Your question keeps wrongly formulated: assoc .vbsc= <--- works and says that cannot find the file "---", see documentation for < Less-Than Sign explanation. For proof, run it again after echo(>--- or another --- file creating procedure. assoc .vbsc with no additional trailing characters should give right result. In case of File association not found for extension .vbsc message try reg query hkcu\Software\Classes\.vbsc /S as assoc does not test HKCU but only HKCR – JosefZ May 2 '16 at 16:18
  • BTW, assoc .ext= will delete the association for that .ext file extension if run elevated but otherwise would raise Errorlevel 5 with Access is denied message. – JosefZ May 2 '16 at 16:49
  • @JosefZ You misunderstand again, you don't realize that <----- is an ARROW draw in ascii. It's not a command. And the output as you should be able to see, says nothing about any "---" file. My question shows that I ran assoc .vbsc= and got the error but ran assoc .abcd= and did not get the error. And of course nowhere did the error mention anything that you says it mentioned, just look at the error, it's there in my question. – barlop May 2 '16 at 17:40
1

added note from barlop -- solution was the troubleshooting step of reg query hkcr\.vbsd and with /s will among other things, include values. This differs from hkcr.abcd and the solution is to delete the key. Let assoc produce the key and what is necessary within that key. ----

After all explanation, I can reproduce the problem:

C:\Windows\system32> assoc .vbsd=

C:\Windows\system32> assoc .vbsd=abc
.vbsd=abc

C:\Windows\system32> assoc .vbsd=

C:\Windows\system32> assoc .vbsd=

C:\Windows\system32> reg add HKCR\.vbsd\AnyKeyName /f
The operation completed successfully.

C:\Windows\system32> assoc .vbsd=
The system cannot find the file specified.

C:\Windows\system32> reg delete HKCR\.vbsd\AnyKeyName /f
The operation completed successfully.

C:\Windows\system32> assoc .vbsd=

C:\Windows\system32> assoc .vbsd=

C:\Windows\system32>

Here are protocols from Process Monitor: successful assoc .vbsd=

"Process Name","Operation","Path","Result","Detail"
"cmd.exe","RegQueryKey","HKLM","SUCCESS","Query: HandleTags, HandleTags: 0x0"
"cmd.exe","RegOpenKey","HKCR","SUCCESS","Desired Access: Maximum Allowed, Granted Access: All Access"
"cmd.exe","RegQueryKey","HKCR","SUCCESS","Query: HandleTags, HandleTags: 0x0"
"cmd.exe","RegOpenKey","HKCR\.vbsd","SUCCESS","Desired Access: Delete"
"cmd.exe","RegDeleteKey","HKCR\.vbsd","SUCCESS",""
"cmd.exe","RegCloseKey","HKCR\.vbsd","SUCCESS",""
"cmd.exe","RegQueryKey","HKLM","SUCCESS","Query: HandleTags, HandleTags: 0x0"
"cmd.exe","RegOpenKey","HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer","SUCCESS","Desired Access: Query Value"
"cmd.exe","RegQueryValue","HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\GlobalAssocChangedCounter","SUCCESS","Type: REG_DWORD, Length: 4, Data: 108"
"cmd.exe","RegCloseKey","HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer","SUCCESS",""
"cmd.exe","RegQueryKey","HKLM","SUCCESS","Query: HandleTags, HandleTags: 0x0"
"cmd.exe","RegCreateKey","HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer","SUCCESS","Desired Access: Set Value, Disposition: REG_OPENED_EXISTING_KEY"
"cmd.exe","RegSetValue","HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\GlobalAssocChangedCounter","SUCCESS","Type: REG_DWORD, Length: 4, Data: 109"
"cmd.exe","RegCloseKey","HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer","SUCCESS",""
"cmd.exe","RegCloseKey","HKCR","SUCCESS",""

And unsuccessful assoc .vbsd= with unexpected The system cannot find the file specified message:

"Process Name","Operation","Path","Result","Detail"
"cmd.exe","RegQueryKey","HKLM","SUCCESS","Query: HandleTags, HandleTags: 0x0"
"cmd.exe","RegOpenKey","HKCR","SUCCESS","Desired Access: Maximum Allowed, Granted Access: All Access"
"cmd.exe","RegQueryKey","HKCR","SUCCESS","Query: HandleTags, HandleTags: 0x0"
"cmd.exe","RegOpenKey","HKCR\.vbsd","SUCCESS","Desired Access: Delete"
"cmd.exe","RegDeleteKey","HKCR\.vbsd","CANNOT DELETE",""
"cmd.exe","RegCloseKey","HKCR\.vbsd","SUCCESS",""
"cmd.exe","RegQueryKey","HKCR","SUCCESS","Query: HandleTags, HandleTags: 0x0"
"cmd.exe","RegOpenKey","HKCR\.vbsd","SUCCESS","Desired Access: Maximum Allowed, Granted Access: All Access"
"cmd.exe","RegDeleteValue","HKCR\.vbsd\(Default)","NAME NOT FOUND",""
"cmd.exe","RegCloseKey","HKCR\.vbsd","SUCCESS",""
"cmd.exe","RegCloseKey","HKCR","SUCCESS",""

Unfortunately, I can't discover where subkeys under HKCR\.vbsc come from in your case.

added note from barlop --- As to where it came from, I think it was a combination of 'default programs editor' and start/orb.."change the file type associated with a specific extension" and making a .vbsc icon and choosing a program with open with, and assoc ----

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.