Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Classic Shell/Explorer Custom Command


19 May 2013   #1
BXF

Windows 7 Pro 64bit
 
 
Classic Shell/Explorer Custom Command

Hi,

I've created a Custom Command under Classic Explorer that invokes a VBS script. If the command contains E:\abcdef.vbs, it works. If, however, I change it to E:\abcdef.vbs "%3", nothing happens, even though there is no reference to the argument within the script.

For what it's worth, here is the script:

Dim WshShell, objFSO, FileList, strFileName, MKLCommand, I

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

Const ForReading = 1

'FileList = WScript.Arguments(0)
FileList="F:\Global Temp\ceiA611.tmp"
WScript.Echo FileList

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(FileList, ForReading)

Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
I = InStrRev(strNextLine,"\")
strFileName = Right(strNextLine,Len(strNextLine)-I)
MKLCommand = "cmd.exe /c mklink ""E:\FPVTemp\" & strFileName & """ """ & strNextLine & """"
WshShell.Run(MKLCommand)
Loop

Any suggestions would be appreciated.

Thanks.


My System SpecsSystem Spec
.

19 May 2013   #2
Ivo

Windows 7 Home 64, Vista Ultimate 64
 
 

You can use Process Monitor to see if a process is being launched and with what exact parameters.
My System SpecsSystem Spec
19 May 2013   #3
BXF

Windows 7 Pro 64bit
 
 

I'm not sure exactly what I should be looking for, but I did find this, while monitoring Explorer.EXE:


Operation: CreateFile

Result: NAME INVALID

Path: E:\MKLink.vbs "F:\GLOBAL~1\


My TEMP folder is F:\Global Temp.

Looks like the name being passed is truncated.

This operation is preceded by some successful operations on F:\Global Temp\ceiF6DD.tmp.

Thanks for your help.
My System SpecsSystem Spec
.


19 May 2013   #4
Ivo

Windows 7 Home 64, Vista Ultimate 64
 
 

That's probably fine. It tries a few things to figure out what part is the exe and what part is the argument. To avoid confusion use quotes around E:\MKLink.vbs.
My System SpecsSystem Spec
20 May 2013   #5
BXF

Windows 7 Pro 64bit
 
 

Hi Ivo,

I had already tried it with quotes before I posted. I tried again, but no change.

I'm attaching two extracts from Process Monitor (renamed to .txt for upload). The difference is quite dramatic

It may be useful to point out that replacing the .VBS with .BAT appears to work, even with the "%3".

Thanks.


Attached Files
File Type: txt Bad Extract.PML.txt (644.0 KB, 1 views)
File Type: txt Good Extract.PML.txt (915.5 KB, 0 views)
My System SpecsSystem Spec
20 May 2013   #6
Ivo

Windows 7 Home 64, Vista Ultimate 64
 
 

Please attach the exact VBS file you are using, and the string you use for your command.
Also, what are you trying to do?
My System SpecsSystem Spec
20 May 2013   #7
BXF

Windows 7 Pro 64bit
 
 

Script attached. It creates Symbolic Links for selected files, in another folder.

The command (Copy/Pasted): "E:\MKLink.vbs" "%3"

Enjoy!


Attached Files
File Type: vbs MKLink.vbs (653 Bytes, 3 views)
My System SpecsSystem Spec
21 May 2013   #8
BXF

Windows 7 Pro 64bit
 
 

Hi Ivo,

I've solved MY problem by compiling the VBScript to an EXE, which runs fine.

I do have another question, please. The Help section says "Note to developers: When %3 or %4 is used, it is the responsibility of the command to delete the temporary file when it finishes", but the file is locked until the command terminates (in use by Explorer). What is the proper way to get around this?

Thanks.
My System SpecsSystem Spec
22 May 2013   #9
Ivo

Windows 7 Home 64, Vista Ultimate 64
 
 

I looked at the code and it seems fine. I close the file before calling the command, so the file shouldn't be in use.
I will run some tests during the weekend.
My System SpecsSystem Spec
22 May 2013   #10
BXF

Windows 7 Pro 64bit
 
 

Sorry, stupid me. It is I who still has the file open (I'm not a Windows programmer).

My apologies.
My System SpecsSystem Spec
Reply

 Classic Shell/Explorer Custom Command




Thread Tools



Similar help and support threads for2: Classic Shell/Explorer Custom Command
Thread Forum
Solved Can shell32.dll remove explorer toolbar using custom classic theme? Customization
classic shell issue Customization
How does it looks like and how do I use Explores Classic Shell? General Discussion
QTTabbar and Classic Shell Customization
Classic Shell Customization
ANN: new Classic Shell versions 1.0.3 and 1.9.0 Customization
Looking for a designer to do some art for Classic Shell Customization

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 01:41 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33