If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#31
|
|||
|
|||
running many files through the same command
From what I know
%1 = shortname %L = longname but depending on the programming environment, they may be converted "behind the scenes", so milage may vary.. "%1" %* is used for executables. Could that be the one that passes multiple command-line variables? I seem to remember seeing %2, but have no idea what it means, as it passes nothing in a simple test. I don't know of a reference off hand. Do a search for shell + extensions + %1 + registry "Ivan Bútora" wrote in message ... Also, what does %* mean when it's used in a similar context as %1? Is there a web page somewhere where one can read all about the possibilities for explorer file manipulation? Thanks, Ivan "Bill Blanton" wrote in message ... You are right, Ivan. I thought explorer passed "%1" like so program.exe arg1 arg2 ... argn |
#32
|
|||
|
|||
running many files through the same command
OK, this did it now, even without full path to pre602.exe, since I have =
that covered by autoexec.bat. Thanks for all your help with this. I feel sort of bad that you were = just sending me scripts and there wasn't much effort to learn windows = scripting on my part, but one cannot do everything. Ivan "Bill Blanton" wrote in message = ... IOW, the send to function basically passes the all the arguments at once to the program. Using the reg's = "shell\open\command\progname.exe "%1"" method passes each file one at a time on a new commandline. =20 Yes, the full paths to the files needs to be specified or do a CD at = the top of the bat. The first method, which I use below, has the added benefit = of being able to use it across folders (i.e. in the "find" window). =20 Change the constant ********PROG_DIR to reflect the full directory = path\ to pre602.exe =20 =20 ''''''''''''''''''''''''''''''''''''''''''''''' Dim oFSO, oShell Dim aCmdArgs Dim oFile, oFolder Dim sTempBatFile, sShortDir, s602Name, sCmdline Dim hDestFile, oDestTextStream =20 Const TEMP_DIR=3D2 Const WRITE_ONLY=3D2 Const ASCII=3D0 '*************** Const PROG_DIR=3D"D:\TEMP\CONVER~1\" ' dir name must have trailing = \ '*************** Set oFSO=3DCreateObject("Scripting.FileSystemObject") Set oShell=3Dwscript.CreateObject("WScript.Shell") =20 Set aCmdArgs=3Dwscript.arguments =20 If aCmdArgs.count 0 Then =20 sTempBatFile=3DoFSO.GetSpecialFolder(TEMP_DIR) & "\" & = oFSO.GetBaseName(oFSO.GetTempName) & ".bat" =20 oFSO.CreateTextFile sTempBatFile =20 Set hDestFile=3DoFSO.GetFile(sTempBatFile) Set oDestTextStream=3DhDestFile.OpenAsTextStream(WRITE _ONLY,ASCII) =20 oDestTextStream.WriteLine("@echo off") =20 =20 For Each x In aCmdArgs =20 Set oFile=3DoFSO.GetFile(x) Set oFolder=3DoFSO.GetFolder(oFile.ParentFolder) =20 sShortDir=3DoFolder.ShortPath If Not oFolder.IsRootFolder Then sShortDir=3DsShortDir + "\" End If =20 s602Name=3DsShortDir + oFSO.GetBaseName(oFile.ShortName) + ".602" =20 sCmdline=3DPROG_DIR + "pre602.exe /d:5" + " " + oFile.ShortPath + = " " + s602Name =20 oDestTextStream.WriteLine("echo" + " " + sCmdline) 'remove to not = echo the command line oDestTextStream.WriteLine(sCmdline) oDestTextStream.WriteLine("echo.") =20 Next =20 oDestTextStream.WriteLine("pause") 'remove to not have to close = window oDestTextStream.WriteLine("cls") oDestTextStream.Close =20 oShell.Run sTempBatFile,,TRUE =20 oFSO.DeleteFile(sTempBatFile) =20 End If =20 wscript.quit =20 ''''''''''''''''''''''''''''''''''''''''''''''' =20 =20 =20 "Ivan B=FAtora" wrote in message = ... I must admit that I don't quite understand where the accumulation of = arguments actually happens, and how the send to menu is distinctive in this sense - but I guess I would have to understand the = actually script in order to get a good sense of what's going on. Anyway, I did create a shortcut to convert.vbs in C:\Windows\SendTo, = and now it indeed just creates one batch file, but gives the errors that you mentioned. Those errors indeed mean "file (...) not = found" in Czech. Is the issue now the full path to the files that we want to convert? =20 Thanks for your help with this, =20 Ivan =20 =20 =20 |
#33
|
|||
|
|||
running many files through the same command
No problem. I enjoy writing small scripts and it helps to keep
in practice and familiar with the language. You're right though, one cannot do everything. Sometimes getting anything done at all is a nightmare :-) Glad to help.. "Ivan Bútora" wrote in message ... OK, this did it now, even without full path to pre602.exe, since I have that covered by autoexec.bat. Thanks for all your help with this. I feel sort of bad that you were just sending me scripts and there wasn't much effort to learn windows scripting on my part, but one cannot do everything. Ivan "Bill Blanton" wrote in message ... IOW, the send to function basically passes the all the arguments at once to the program. Using the reg's "shell\open\command\progname.exe "%1"" method passes each file one at a time on a new commandline. Yes, the full paths to the files needs to be specified or do a CD at the top of the bat. The first method, which I use below, has the added benefit of being able to use it across folders (i.e. in the "find" window). Change the constant ********PROG_DIR to reflect the full directory path\ to pre602.exe ''''''''''''''''''''''''''''''''''''''''''''''' Dim oFSO, oShell Dim aCmdArgs Dim oFile, oFolder Dim sTempBatFile, sShortDir, s602Name, sCmdline Dim hDestFile, oDestTextStream Const TEMP_DIR=2 Const WRITE_ONLY=2 Const ASCII=0 '*************** Const PROG_DIR="D:\TEMP\CONVER~1\" ' dir name must have trailing \ '*************** Set oFSO=CreateObject("Scripting.FileSystemObject") Set oShell=wscript.CreateObject("WScript.Shell") Set aCmdArgs=wscript.arguments If aCmdArgs.count 0 Then sTempBatFile=oFSO.GetSpecialFolder(TEMP_DIR) & "\" & oFSO.GetBaseName(oFSO.GetTempName) & ".bat" oFSO.CreateTextFile sTempBatFile Set hDestFile=oFSO.GetFile(sTempBatFile) Set oDestTextStream=hDestFile.OpenAsTextStream(WRITE_O NLY,ASCII) oDestTextStream.WriteLine("@echo off") For Each x In aCmdArgs Set oFile=oFSO.GetFile(x) Set oFolder=oFSO.GetFolder(oFile.ParentFolder) sShortDir=oFolder.ShortPath If Not oFolder.IsRootFolder Then sShortDir=sShortDir + "\" End If s602Name=sShortDir + oFSO.GetBaseName(oFile.ShortName) + ".602" sCmdline=PROG_DIR + "pre602.exe /d:5" + " " + oFile.ShortPath + " " + s602Name oDestTextStream.WriteLine("echo" + " " + sCmdline) 'remove to not echo the command line oDestTextStream.WriteLine(sCmdline) oDestTextStream.WriteLine("echo.") Next oDestTextStream.WriteLine("pause") 'remove to not have to close window oDestTextStream.WriteLine("cls") oDestTextStream.Close oShell.Run sTempBatFile,,TRUE oFSO.DeleteFile(sTempBatFile) End If wscript.quit ''''''''''''''''''''''''''''''''''''''''''''''' "Ivan Bútora" wrote in message ... I must admit that I don't quite understand where the accumulation of arguments actually happens, and how the send to menu is distinctive in this sense - but I guess I would have to understand the actually script in order to get a good sense of what's going on. Anyway, I did create a shortcut to convert.vbs in C:\Windows\SendTo, and now it indeed just creates one batch file, but gives the errors that you mentioned. Those errors indeed mean "file (...) not found" in Czech. Is the issue now the full path to the files that we want to convert? Thanks for your help with this, Ivan |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Recovering files | DAJ | General | 3 | June 21st 04 05:39 AM |
C Windows profiles user application data | LuckyStrike | General | 24 | June 18th 04 12:13 AM |
Lost access to Windows Help Files | overzealous | General | 2 | June 14th 04 10:08 PM |
Safely delete .exe files in "TEMP" folder?? | CNJ | General | 2 | June 14th 04 06:16 AM |
Question about C:\Windows\Temp files | JR Berry | General | 6 | June 7th 04 09:32 PM |