Jump to content

Recommended Posts

Posted (edited)

Thanks bphlpt trying to improve the batch file!

The last command about "%~0.ELEVATED": CMD argument that you will pass to powershell!

This text file is needed to past the text command file to powershell.

You can try to downlaod my SFX file (EverythingSearch_v1.3.0.rar) and test it. Let us know the result, please.

Link given previously.

Regards

Edited by myselfidem
Posted
I understand that CALL %_ELEVATED_CMD% calls Powershell.

 

I just don't see what copying the contents of %_ELEVATED_CMD% to "%~0.ELEVATED" accomplishes.  If Powershell uses "%~0.ELEVATED", I don't understand the mechanism how it does it.

 

In your "Everything_Schedule.bat", your bitness test is not quite right,  You can't have the statement in the "ELSE", you have to set it before the pair of IF statements and let it be overwritten if required.  See my explanation above.

 

You also missed the run together lines "GOTO exit:ver_vista", which will cause a fatal error for any Vista user.

 

I'll be interested to know if my "Everything_Schedule.bat" works correctly for you in both Win7 x64 and x86, and for Geej in XP.  My file should also work correctly in Win 8.

 

Cheers and Regards
Posted

Thanks for the link.  Here's a really embarrassing question - What's the best way to test the SFX?  I just don't use them very much.

 

Sorry, I just don't know what you mean by "However: REM WinXP doesn't support TN for schtasks /query".  Oh wait. ::slaps head:: #$%#$^ Sorry, I was thinking that was a function of Powershell, not the built-in XP cmd function.  I told you I hadn't used either function.  OK, I'll modify it in a minute.

 

I see you fixed your bitness test, but I am curious why you didn't want to use either of the the two code examples I provided. LOL  They are both shorter than yours. :)  Anyway, if nothing else, you should probably use the environment variables instead of hardcoding them to C:\...

 

Cheers and Regards

Posted (edited)

Thanks!

You can launch the SFX file on your computer and test it !

 

However the batch file worked fine with the previous EverythingSearch.exe and now there a problem with silent installation using VM Oracle about this new beta version (Maybe Everything.inf file ?) . I'm looking why ?

But works fine on my computers x86 and x64bit !!

 

When I have some time I will try your batch file!

Cheers

Edited by myselfidem
Posted

Batch file has been updated.  It ended up it needed it anyway since I left an extra GOTO in by mistake which will cause it to do nothing at all for Win 7.  ::Oops::  It's been fixed above.

 

You can launch the SFX file on your computer and test it !

 

How?  Double-clicking doesn't know how to run it.  Sorry to be a noob sometimes.

 

Cheers and Regards

Posted (edited)

Yes bphlpt, double-clic on the exe file and wait a minute...You will see the EverythingSearch icon on the Taskbar. Restart your computer and thanks to share the result.

Edited by myselfidem
Posted (edited)

OHHH. click the exe not the sfx.  LOL

 

But I already have Everything installed.  I guess I need to uninstall mine then first.  rats  Mine is customized.  Oh well.  OK I'll uninstall mine, test yours, then uninstall yours and reinstall mine.

 

Back in a bit.

 

EDIT:  Nope, unfortunately, your's didn't do anything at all when I double-clicked the exe.  Nothing seemed to happen, looked everywhere for it and checked in "Programs and Features" to look for it, also after rebooting.  Nothing.

 

Cheers and Regards

Edited by bphlpt
Posted (edited)

Yes...I see now. The trouble is with the XP section. I disabled it inside the batch file...and now works fine. Test it a new time, please.

File updated on Mediafire. Thanks and regards

 

Tested also on VM Oracle and works fine!! :)

https://skydrive.live.com/?cid=d178ea021b182b88&sc=documents&lc=1036&id=D178EA021B182B88%21114#cid=D178EA021B182B88&id=D178EA021B182B88%211512&sc=documents

Edited by myselfidem
Posted

Yep, seems to work OK now at first glance, in French no less! LOL  But it did seem to take longer than I thought it would to install.  I'll be interested to see if you think my bat makes the install any faster.  I think it will.

 

Cheers and Regards

Posted

Thanks for the test!

Yes it's in french, but it's just for testing! ;)

I made some changes inside Everything.inf, removing unwanted lines about xml files !

File updated on Mediafire.

 

Now run faster and works immediately when the installation is done! 

 

Cheers

Posted

The task is needed to run Everything with admin privilege and avoid UAC popup, you don't need it in XP, you just have to add an autostart entry:

 

HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Run","Everything",,"""%16422%\Everything\Everything.exe"" -startup"

 

I have made an inf addon for XP and sfx+inf for win7 (with xml). For me it's the best solution.

 

Someone with knowledge of nsis or other installation engine could make a better installer though.

Or maybe ask the David Carpenter, the developer of Everything, to rewrite his installer to add language, silent install support and automatic creation of task according to OS/arch., like CCleaner.

Posted (edited)

@bphlpt

 

Tested your modified batch file and works really fine and it is faster than the previous one ! :dribble:

Tested and works flawlessly on Windows XP 32bit and Windows 7 32bit and 64bit (without using xml file).

 

Just needed to change the comment to:

.

REM Delete Task if it exists, then Create on Logon running one

 

@Geej

Could you try the batch file given by bphlpt, please.

 

File (SFX) updated on Mediafire for testing and including batch file's bphlpt ! French used ;)

 

Cheers and regards

Edited by myselfidem
Posted

@Geej

 

Tried your addon on both x86 and x64 VM. Soon I'll also install it on a real system (the resulted iso with your addon). I have only two small issues to report.

 

1. As you can see attached, although the addon also integrates in a x64 image, it's supposed to be shown as dual arch. It's shown as x86 - some may think it's only meant for x86.

 

2. The Search Everything (UAC) startmenu shortcut doesn't start on a x64 VM with UAC on. However, the normal shortcut without UAC in the title starts. So the whole purpose of having an UAC shortcut is gone, I think it's better you only show one shortcut that works both with UAC on and off - if that is possible, of course. :)

post-25565-0-85322300-1359981218_thumb.p

Posted

bphlpt, thanks for improving the batch file to work across XP/win7 x86/x64 (maybe win8 too).

myselfidem, I can only test in 2-3 days later with his batch file.

If tested okay on x86 VM, I will assume it works in x64 and update .WA in post #1.

Hi, RicaNeaga. On the first issue, when I build the .WA through WTK addon maker, I select x86 (which means for both arch).

Maybe this is how it is display. I dun know. I can't just select !x86 or !x64 only right?

myselfidem have tested the UAC shortcut in x64 and reported okay. Hence I have no clue what is the issue now...

Any further insight would be nice...

edit:

RicaNeaga

I'm guessing either there is no scheduled task created via the x64 xml file or the Shortcut UAC path is wrong.

Has the scheduled task created successfully in your system?

(I presumed you are using the xml file)

What is the UAC shortcut path full string as listed in the .lnk properties?

Could you post the string ?

BTW, it is not possible to have only 1 shortcut that work with both UAC on and off. Commands are different.

If you have UAC on and just run Everything.exe, the program won't have access to protected window folders and wouldn't display files that are in there.

Just a side note to all: When run as silent installer (SFX), it is calling [LiveInstall] section.

When run via WTK as .WA addon, it is calling [install] section during RunOnce.

The difference is that [install] section does not perform filecopy operation as WTK will do that during integration.

Posted (edited)

130204035306429711.jpg

 

I have asked David Carpenter, developer of Everything, if he can rewrite his installer, he have answered that the next major release will be an client-server approach, eliminating the problems with UAC and the fact that anything you run from "Everything" is being elevated.

It might also be open-sourced .

Edited by mooms
Posted (edited)

Batch has been slightly cleaned up and a small potential problem has been corrected in the XP section.  Please use and verify this version.

 

 

@ECHO OFF & SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION::***********************************************************:::: Everything_Schedule.bat                                   :::: Sets variables _Schedule, _TaskName, _Task and goes ahead :::: Original script from: http://myunster.com                 :::: Modified by bphlpt 2013-02-05                             ::::***********************************************************::CALL :sub_CleanUp REM Set Task specific variables - %ProgramFiles% will be used if OS is 32-bit, %ProgramFiles(x86)% if OS is 64-bit(SET "_Schedule=ONLOGON")(SET "_TaskName=Everything")(SET "_X86=(x86)") & (IF NOT EXIST "%SystemRoot%\SysWOW64\cmd.exe" (IF NOT DEFINED PROCESSOR_ARCHITEW6432 (SET "_X86=")))(SET _Task=\"%%ProgramFiles%_X86%%%\Everything\Everything.exe\" -startup) REM Check if OS is XP, if it is not XP then check for PowerShell in case it was uninstalledFOR /F "tokens=2 delims=[]" %%G IN ('VER') DO (SET "_WinVer=%%G")FOR /F "tokens=2 delims=. " %%G IN ('ECHO %_WinVer%') DO (IF "%%G"=="5" GOTO:treatAsXP)START "Get Windows Version" /WAIT REGEDIT /E "%TEMP%.\_Temp.reg" "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1"IF EXIST "%TEMP%.\_Temp.reg" (FOR /F "tokens=1* delims=:" %%G IN ('TYPE "%TEMP%.\_Temp.reg" ^| FIND /I "Install"') DO (    (SET /A "_PSInstalled=%%H") & (IF "!_PSInstalled!"=="1" GOTO:psFound))) :treatAsXPREM or PowerShell NOT found - using FINDSTR is necessary since WinXP does not support TN for schtasks /query(SET _Result="-1") & FOR /F "delims=, tokens=2" %%R IN ('SCHTASKS /query /fo csv /v ^| FINDSTR /L /C:"%_TaskName%"') DO (SET _Result=%%R)IF "%_TaskName%"==%Result% (SCHTASKS /Delete /TN "%_TaskName%" /F)SCHTASKS /Create /TN "%_TaskName%" /TR "%_Task%" /SC %_Schedule% /RL HIGHESTGOTO:exit :psFoundREM Do not forget to escape any double quotes in CMD arguments that you will pass to PowerShellSET _Argument=SCHTASKS /Create /TN \"%_TaskName%\" /TR \"%_Task%\" /SC %_Schedule% /RL HIGHEST /FSET _ELEVATED_CMD=PowerShell -Command (New-Object -com 'Shell.Application').ShellExecute('Cmd.exe', '/C %_Argument%', '', 'runas')PushD "%~dp0"DEL /F "%~0.ELEVATED" >NUL 2>&1ECHO %_ELEVATED_CMD% >"%~0.ELEVATED"CALL %_ELEVATED_CMD%DEL /F "%~0.ELEVATED" >NUL 2>&1PopDGOTO:exit :sub_CleanUpREM Clean up any leftover files or variablesDEL "%TEMP%.\_Temp.reg" >NUL 2>&1FOR /F "tokens=1* delims==" %%G IN ('"SET "_" 2>nul"') DO (SET "%%G=")EXIT /B 0 :exitCALL :sub_CleanUpENDLOCAL & EXIT
Edited by bphlpt
Posted

@bphlpt, for some reason, I have tested your earlier batch file on win7 x86 and it does not create a task in Task scheduler.

I tried your post #75 batch file and myselfidem's link (I take the batch file only) in post #80. (both doesn't work)

This is how I test (if it helps):

On VM which has an already installed Everything program, I launch taskschd.msc via Run box, then end existing task, follow by delete task.

Then run your batch file manually. Wait a while, check again taskschd.msc to refresh the screen and no task was created.

If you do the same as I did, is the task created? Or does my test method wrong?

Nevertheless, I will still try your revised batch.

Cheers

Posted (edited)

Yes, you're right Geej!

I did not pay attention but the Task Schedule isn't created.

Testing the new one you gave bphlpt (post #95) and doesn't create the Task Shedule.

 

Thanks and regards

 

File on MediaFire updated with previous Everything_Schedule.bat working...But can be improved!

Edited by myselfidem
Posted (edited)
I'll look at it in more detail later this evening, but if anyone can point to anything I did different than the original, as far as the scheduling of the Task is concerned, that would be a big help.  (I kept saying that I've never used either SCHTASKS or PowerShell.  No excuse I know, but...)

 

Cheers and Regards

 

Original for Win7 (post #74):


:ver_7
:Run Windows 7 specific commands here.
GOTO Elevation
:Elevation
REM Don't forget escape double quotes for CMD argument that you will pass to powershell
PushD "%~dp0"
IF EXIST "%~0.ELEVATED" DEL /F "%~0.ELEVATED"
SET Argument=SCHTASKS /Create /F /TN \"%TaskName%\" /TR \"%Task%\" /SC ONLOGON /RL HIGHEST
SET ELEVATED_CMD=PowerShell -Command (New-Object -com 'Shell.Application').ShellExecute('Cmd.exe', '/C %Argument%', '', 'runas')
ECHO %ELEVATED_CMD% >> "%~0.ELEVATED"
CALL %ELEVATED_CMD%
DEL /F "%~0.ELEVATED"
PopD
GOTO exit
:exit

 

My latest (post #95) [%_Schedule%=ONLOAD]:


:psFound
REM Do not forget to escape any double quotes in CMD arguments that you will pass to PowerShell
SET _Argument=SCHTASKS /Create /TN \"%_TaskName%\" /TR \"%_Task%\" /SC %_Schedule% /RL HIGHEST /F
SET _ELEVATED_CMD=PowerShell -Command (New-Object -com 'Shell.Application').ShellExecute('Cmd.exe', '/C %_Argument%', '', 'runas')
PushD "%~dp0"
DEL /F "%~0.ELEVATED" >NUL 2>&1
ECHO %_ELEVATED_CMD% >"%~0.ELEVATED"
CALL %_ELEVATED_CMD%
DEL /F "%~0.ELEVATED" >NUL 2>&1
PopD
GOTO:exit

 

Original for XP:


:ver_xp
:Run Windows XP specific commands here.
REM Delete variable, may be cached
SET "Result="
REM WinXP doesn't support TN for schtasks /query
FOR /F "delims=, tokens=2" %%R IN ('schtasks /query /fo csv /v ^| findstr /L /C:"%TaskName%"') DO SET Result=%%R
IF (%Result%)==() SET Result="-1"
IF "%TaskName%" == %Result% (
REM Delete Task if it exists       
        SCHTASKS /Delete /TN "%TaskName%" /F
)
REM Then Create on Logon running one
SCHTASKS /Create /TN "%TaskName%" /TR "%Task%" /SC ONLOGON /RL HIGHEST
GOTO exit

 

My latest:


:treatAsXP
REM or PowerShell NOT found - using FINDSTR is necessary since WinXP does not support TN for schtasks /query
(SET _Result="-1") & FOR /F "delims=, tokens=2" %%R IN ('SCHTASKS /query /fo csv /v ^| FINDSTR /L /C:"%_TaskName%"') DO (SET _Result=%%R)
IF "%_TaskName%"==%Result% (SCHTASKS /Delete /TN "%_TaskName%" /F)
SCHTASKS /Create /TN "%_TaskName%" /TR "%_Task%" /SC %_Schedule% /RL HIGHEST
GOTO:exit

 

 

Cheers and Regards
Edited by bphlpt
Posted

I got some news...
I tried to create the task using commandline schtasks /create syntax via inf.
Good news is that it can be create it.


 

Since I don't have x64 to test, I hope RicaNeaga, bphlpt, myselfidem or mooms can feedback whether TestCreateSchtasks.inf run correctly on x64. (in VM at least)
Before you run this inf, just End + Delete existing TaskName if exists.

 

Things I hope to know are:
1) Is task created successfully
2) Search Everything (UAC).lnk able to start everything.exe and icon appear in systray

 

If above 2 condition works fine, then I will modify inf w/o Everything_Schedule.bat or xml and get it tested at least on x86 VM with WTK.
Take your time to test. No hurry.

 

TestCreateSchtasks.txt

 

Pls change extension to TestCreateSchtasks.inf

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...