| 1. |
Solve : Capture multiple selected File Names in Text File? |
|
Answer» Hi All, For eg.: If i select 10 files, this post-processing command is repeated 9 times. Is this always true? For instance if you select 5 files, do only 4 get passed? Seems odd that it would stop working when the parameters are no longer addressable. If that's true then this piece of code won't help, but hey you never know! Code: [Select]@echo off for /f "tokens=* delims=" %%v in ("%*") do ( set str=%%v ) set /a count=1 :top for /f "tokens=%count%" %%v in ("%str%") do ( echo %%v >> names.txt call set /a count=%%count%%+1 goto top ) :out echo %saspath% -sysin F:\share\Manohar\pgm\chklog_asg.sas %options% >> names.txt Perhaps to can give us more info on how this batch file is connected to explorer and what prompts it's execution. Hi, Thanks! for your reply. But the issue still exists. To give you idea about how this batch file is executed, I went to Tools->Folder Options->File Types->.sas( SAS Program) -> Advance -> ChkLog(menu item) I have following command pasted : F:\Share\Manohar\copy.bat "%1" in action perfomed box. What I basically want to do is get names of selected .sas programs, execute them and check their log files. When I run your code below is the OUTPUT I am getting "F:\Share\manohar\v_adhy.sas" "C:\Program Files\SAS\SAS 9.1\sas.exe" -sysin F:\share\Manohar\pgm\chklog_asg.sas -nosplash -icon "F:\Share\manohar\v_adfb.sas" "C:\Program Files\SAS\SAS 9.1\sas.exe" -sysin F:\share\Manohar\pgm\chklog_asg.sas -nosplash -icon "F:\Share\manohar\v_adfh.sas" "C:\Program Files\SAS\SAS 9.1\sas.exe" -sysin F:\share\Manohar\pgm\chklog_asg.sas -nosplash -icon "F:\Share\manohar\v_adhb_29feb.sas" "C:\Program Files\SAS\SAS 9.1\sas.exe" -sysin F:\share\Manohar\pgm\chklog_asg.sas -nosplash -icon "F:\Share\manohar\v_adhb_sure.sas" "C:\Program Files\SAS\SAS 9.1\sas.exe" -sysin F:\share\Manohar\pgm\chklog_asg.sas -nosplash -icon You can see that chklog_asg.sas program is selected multiple times. All I want is to be selected once and that too at the end. Is it has to do with %1 parameter which I pass in action performed box. I even tried to remove that %1 but windows by defualt enter it again. Please provide your input. Thanks!I seem to remember to something a similar way back. For some REASON the "%L" variable was used on the command line in Windows. Try using open in the action box and in the application used to perform action box USE "F:\Share\Manohar\copy.bat" "%L". And make sure the DDE box is checked. Seems the %L is a system variable used in Windows Explorer. Hi, Thanks! again for your reply. But no LUCK. It still executes the :out code n number of times. The output still is: "F:\Share\manohar\v_adhb_29feb.sas" "C:\Program Files\SAS\SAS 9.1\sas.exe" -sysin F:\share\Manohar\pgm\chklog_asg.sas -nosplash -icon "F:\Share\manohar\v_adfb.sas" "C:\Program Files\SAS\SAS 9.1\sas.exe" -sysin F:\share\Manohar\pgm\chklog_asg.sas -nosplash -icon "F:\Share\manohar\v_adfh.sas" "C:\Program Files\SAS\SAS 9.1\sas.exe" -sysin F:\share\Manohar\pgm\chklog_asg.sas -nosplash -icon Not sure which batch file you're using. (yours or mine posted earlier). In any case add a pause statement at the end, make sure echo is off, and post the console listing. Something does not make sense; if each file selected is run thru a batch file separately, there should be n number of post processing commands, not n-1. If the files are submitted to the batch file as a group then I can find not an error in your original logic. Maybe the console list will give us some insight. |
|