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.
and it gets stranger.
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.
'assocc'
is not recognized butassoc
works… See typo in the first assocc (note doubled c)assoc .vbsc= <---
works and says that cannot find the file"---"
, see documentation for<
Less-Than Sign explanation. For proof, run it again afterecho(>---
or another---
file creating procedure.assoc .vbsc
with no additional trailing characters should give right result. In case ofFile association not found for extension .vbsc
message tryreg query hkcu\Software\Classes\.vbsc /S
asassoc
does not testHKCU
but onlyHKCR
assoc .ext=
will delete the association for that.ext
file extension if run elevated but otherwise would raiseErrorlevel
5 withAccess is denied
message.<-----
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 ranassoc .vbsc=
and got the error but ranassoc .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.