myselfidem Posted February 6, 2013 Posted February 6, 2013 (edited) Thanks Geej!Yes the Task is created on my computer with Windows 7 x86.However I put the Everything_Schedule.bat on a diet and works on Windows XP and Windows 7 x86.On Windows XP the task is created but the icon doesn't appear on the task bar ?Maybe you can add inside the Everything.inf the task command for Windows XP ?Everything_Schedule.bat::*******************************************:::: Everything_Schedule.bat :::: Set variables TaskName, Task and go ahead :::: http://myunster.com]http://myunster.com ::::*******************************************::@ECHO offREM Set variablesSET TaskName=EverythingREM Following task will be executed on Logon:: Detect OS bit-ness on running system.:: Assumes 64-bit unless 64-bit components do not exist.SET "ARCH=64"IF NOT EXIST "%SystemRoot%\SysWOW64\cmd.exe" ( IF NOT DEFINED PROCESSOR_ARCHITEW6432 SET "ARCH=32" ) ::Begin install IF "%ARCH%"=="64" ( SET Task=\"C:\Program Files (x86)\Everything\Everything.exe\" -startup ) ELSE ( SET Task=\"C:\Program Files\Everything\Everything.exe\" -startup )REM Determine windows versionFOR /F "tokens=2* delims= " %%A IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ProductName"') DO SET OSVer=%%BECHO %OSVer% | FINDSTR /I "XP" >NULIF %ERRORLEVEL% == 0 GOTO ver_xpFOR /F "tokens=* delims= " %%A IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ProductName"') DO SET OS=%%AECHO %OS% | FINDSTR /I "Vista" >NULIF %ERRORLEVEL% == 0 GOTO ver_vistaECHO %OS% | FINDSTR /I "7" >NULIF %ERRORLEVEL% == 0 GOTO ver_7:ver_xpSCHTASKS /Create /TN "%TaskName%" /TR "%Task%" /RU "SYSTEM" /SC ONLOGONGOTO exit:ver_vista::Run Windows Vista specific commands here.GOTO Elevation:ver_7SCHTASKS /Create /TN "%TaskName%" /TR "%Task%" /SC ONLOGON /RL HIGHESTGOTO Elevation:ElevationREM Don't forget escape double quotes for CMD argument that you will pass to powershellPushD "%~dp0"IF EXIST "%~0.ELEVATED" DEL /F "%~0.ELEVATED"SET Argument=SCHTASKS /Create /F /TN \"%TaskName%\" /TR \"%Task%\" /SC ONLOGON /RL HIGHESTSET 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"PopDGOTO exit:exitEXITSFX file updated on Mediafire for testing.Thanks and regards Edited February 6, 2013 by myselfidem Quote
Geej Posted February 7, 2013 Author Posted February 7, 2013 Hi myselfidemI have no wish to add xp support for .WA addon (and I could not get the syntax right via inf)But if you are using for your own use using Everything_Schedule.bat,I have experiment around in XP VM to check the required syntax to get icon appear on system tray.(I assumed you are using the batch code you post in #101)Find this section in the batch file (around line 31) and run the batch file.:ver_xp::SCHTASKS /Create /TN "%TaskName%" /TR "%Task%" /RU "SYSTEM" /SC ONLOGONSCHTASKS /Create /S \\%userdomain% /RU %username% /RP justforfun /sc ONLOGON /TN "%TaskName%" /TR "%Task%"pause && REM delete this entire line after test.GOTO exitJust my thought on the followings (may not be 100% right, still learning...)The reason why the original code for XP did not work is because {/RU "SYSTEM"} runs as {NT AUTHORITY\SYSTEM} context.This context is non-interactive. That is why no system tray icon shown up on your systray.(non-interactive means you can't bring up the program GUI to make your search as you cannot interact with the program interface).So to create an interactive logon, you need to provide a user name & password. This password is use to login to XP.My XP do not have login password as it is autoboot+login to desktop w/o password.Hence I have to create a password (I use justforfun as password as an example) for myself so that I can create a task schedule.I must admit getting the correct syntax is harder in XP than in Win7 because many switches are not available.I have a hard time figuring out what should be the parameters for /SBy trial and error and lots of guessing, finally got this magic syntax '\\%userdomain%'.The %userdomain% can simply view the actual value on console box using set command (set command w/o passing any parameters).You can also modify line 20 which hasSET Task=\"C:\Program Files\Everything\Everything.exe\" -startuptoSET Task=\"%ProgramFiles%\Everything\Everything.exe\" -startupYou can test your batch but each time you test, you must delete the existing taskname, otherwise your batch will be pause/error out and your task will not be created.2 useful XP commands syntax if you are testing on the console.schtasks /query (to view if task is created successfully)schtasks /delete /TN Everything /F (quickly clear task before re-test the batch file)HTH... Quote
bphlpt Posted February 7, 2013 Posted February 7, 2013 On the other hand, I choose to run "Everything" as a portable app, ie not actually installed, and with no registration entries and do not have it ever show up on the task bar at all. In fact, I use the search function infrequently enough that I do not keep the program running and only launch it when I actually need to search for something. But to each their own. Cheers and Regards Quote
mooms Posted February 8, 2013 Posted February 8, 2013 As I have posted earlier, there is no need to start it from a task in XP, just use the autostart option in the program itself or create the key in the registry. Quote
Geej Posted February 8, 2013 Author Posted February 8, 2013 As I have posted earlier, there is no need to start it from a task in XP, just use the autostart option in the program itself or create the key in the registry.Correct. I remove the HKLM....,Run key for .WA addon.And keep HKLM....,Run key for XP inf addonBut for myselfidemhis question was how to run get the icon appear using task scheduler.@myselfidem, you can also add HKLM....,Run key if you wish. (See mooms post #90).Note: It will be removed during uninstallJust looking forward to see new update from the developer. Quote
myselfidem Posted February 8, 2013 Posted February 8, 2013 Thank you Geej for clear explanations! Keep your good work.Regards Quote
myselfidem Posted February 8, 2013 Posted February 8, 2013 (edited) @Geej!Using your help I created a new batch file for Windows XP and Windows 7 working fine for me: Everything_Shedule.bat::*******************************************:::: Everything_Schedule.bat :::: Set variables TaskName, Task and go ahead :::: http://myunster.com]http://myunster.com ::::*******************************************::@ECHO offREM Delete variable, may be cachedSET TaskName=EverythingSET "Result="FOR /F "delims=, tokens=2" %%I IN ('schtasks /query /fo csv /v /TN "%TaskName%"') DO SET Result=%%IIF (%Result%)==() SET Result="-1"IF "\%TaskName%" == %Result% (REM Delete Task if it exists SCHTASKS /Delete /TN "%TaskName%" /F)REM Following task will be executed on Logon:: Detect OS bit-ness on running system. Assumes 64-bit unless 64-bit components do not exist.SET "ARCH=64"IF NOT EXIST "%SystemRoot%\SysWOW64\cmd.exe" ( IF NOT DEFINED PROCESSOR_ARCHITEW6432 SET "ARCH=32" ) ::Begin install IF "%ARCH%"=="64" ( SET Task=\"%%ProgramFiles(x86)%%\Everything\Everything.exe\" -startup ) ELSE ( SET Task=\"%%ProgramFiles%%\Everything\Everything.exe\" -startup )REM Determine windows versionFOR /F "tokens=2* delims= " %%A IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ProductName"') DO SET OSVer=%%BECHO %OSVer% | FINDSTR /I "XP" >NULIF %ERRORLEVEL% == 0 GOTO ver_xpFOR /F "tokens=* delims= " %%A IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ProductName"') DO SET OS=%%AECHO %OS% | FINDSTR /I "Vista" >NULIF %ERRORLEVEL% == 0 GOTO ver_vistaECHO %OS% | FINDSTR /I "7" >NULIF %ERRORLEVEL% == 0 GOTO ver_7:ver_xpREM Enter a password if needed on /RPSCHTASKS /Create /TN "%TaskName%" /TR "%Task%" /RU "%userdomain%" /RP "" /SC ONLOGONGOTO exit::ver_vista::Run Windows Vista specific commands here.::GOTO Elevation:ver_7SCHTASKS /Create /TN "%TaskName%" /TR "%Task%" /SC ONLOGONGOTO Elevation:ElevationREM Don't forget escape double quotes for CMD argument that you will pass to powershellPushD "%~dp0"IF EXIST "%~0.ELEVATED" DEL /F "%~0.ELEVATED"SET Argument=SCHTASKS /Create /F /TN \"%TaskName%\" /TR \"%Task%\" /SC ONLOGONSET 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"PopDGOTO exit:exitEXITFile updated on Mediafire for testing. Thanks and regards Edited February 8, 2013 by myselfidem Quote
bphlpt Posted February 8, 2013 Posted February 8, 2013 (edited) If this works: :ver_7SCHTASKS /Create /TN "%TaskName%" /TR "%Task%" /SC ONLOGON then this seems redundant: PushD "%~dp0"IF EXIST "%~0.ELEVATED" DEL /F "%~0.ELEVATED"SET Argument=SCHTASKS /Create /F /TN \"%TaskName%\" /TR \"%Task%\" /SC ONLOGONSET 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 I wouldn't think you would need to run SCHTASKS twice, once directly and once via Powershell. If you do, why? Cheers and Regards Edited February 8, 2013 by bphlpt Quote
myselfidem Posted February 10, 2013 Posted February 10, 2013 (edited) After many , many tests I found the Elevated command doesn't work for many reasons! I improved the batch file and works on Windows XP and Windows 7 32bit and 64bit (tested on my computers)! Everything_Schedule.bat ::*******************************************:::: Everything_Schedule.bat :::: Set variables TaskName, Task and go ahead ::::*******************************************::@ECHO offREM Set variablesSET TaskName=EverythingREM Following task will be executed on Logon:: Detect OS bit-ness on running system. Assumes 64-bit unless 64-bit components do not exist.SET "ARCH=64"IF NOT EXIST "%SystemRoot%\SysWOW64\cmd.exe" ( IF NOT DEFINED PROCESSOR_ARCHITEW6432 SET "ARCH=32" ) ::Begin install IF "%ARCH%"=="64" ( SET Task=\"%ProgramFiles(x86)%\Everything\Everything.exe -startup\" ) ELSE ( SET Task=\"%ProgramFiles%\Everything\Everything.exe -startup\" )REM Determine windows versionFOR /F "tokens=2* delims= " %%A IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ProductName"') DO SET OSVer=%%BECHO %OSVer% | FINDSTR /I "XP" >NULIF %ERRORLEVEL% == 0 GOTO ver_xpFOR /F "tokens=* delims= " %%A IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ProductName"') DO SET OS=%%AECHO %OS% | FINDSTR /I "Vista" >NULIF %ERRORLEVEL% == 0 GOTO ver_vistaECHO %OS% | FINDSTR /I "7" >NULIF %ERRORLEVEL% == 0 GOTO ver_7:ver_xpSCHTASKS /Create /S %userdomain% /U %username% /RU %username% /SC ONLOGON /TN "%TaskName%" /TR "%Task%"::ver_vista::Run Windows Vista specific commands here.::GOTO Elevation:ver_7:ElevationREG ADD "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe" /t REG_SZ /d RUNASADMIN /f >NUL PushD "%~dp0"IF EXIST "%~0.ELEVATED" DEL /F "%~0.ELEVATED"SET Argument=SCHTASKS /Create /F /TN "%TaskName%" /TR "%Task%" /SC ONLOGONSET ELEVATED_CMD=PowerShell -Command %Argument%ECHO %ELEVATED_CMD% >> "%~0.ELEVATED"CALL %ELEVATED_CMD%DEL /F "%~0.ELEVATED"PopDGOTO exit:exitEXIT HTH Edited February 10, 2013 by myselfidem Quote
oguz Posted February 10, 2013 Posted February 10, 2013 (edited) Hi everybody,Is this program ok for SSD disk drives? Does it shorten SSD Disk life because it works continuously at the background? :g: (I think it does read/write process continuously) Edited February 10, 2013 by oguz Quote
myselfidem Posted February 10, 2013 Posted February 10, 2013 Yes, I think, using my last batch file given above. I created an SFX file and works fine for me! Quote
Geej Posted February 13, 2013 Author Posted February 13, 2013 This addon does it without using batch file or xml. (A simpler approach to creating scheduler task).I have tested with WTK 1.4.1.14 in VMx86. Works alright.If no user feedback any issue (within 14 days), I will replace with this copy in post #1. EverythingSearchEngineNew_1.3.0.632b.WASize: 431.97 Kb (442,338 bytes)MD5: 7E0508E5800E68443AA917D1EDB775B1 Cheers Quote
mooms Posted February 13, 2013 Posted February 13, 2013 This addon does it without using batch file or xml. (A simpler approach to creating scheduler task). Tested live install on Win7 X64 with VirtualBox: install and uninstall, creation and deletion of the task, shortcuts, everything works without any glitches.Congrats ! Quote
Geej Posted February 14, 2013 Author Posted February 14, 2013 Thanks mooms & myselfidem for the feedback. Good to hear it works fine & install w/o glitches.Thanks to bphlpt to try to script an alternative solution too. While it is not working, I still appreciate your time and effort to code . I'm sure we have learn something from all these batch/inf/sfx scripting, esp task scheduler.Breakthrough comes when exploring a solution for XP task scheduler.After getting to know more schtasks command parameters in XP, I think it is possible using just switches and decided to experiment it out on win7. As it turns out, indeed it can be done. Quote
mooms Posted February 15, 2013 Posted February 15, 2013 It always amazes me how INF is powerful, it seems almost anything can be done with it ! Quote
bphlpt Posted February 15, 2013 Posted February 15, 2013 Though the batch approach has not worked correctly, yet, I haven't given up on the approach since I'm sure there will be occasions where it will be useful. I'll continue to keep you apprised of my progress. If you don't mind Geej, I'll do so here since it sort of began here. Once a "universal solution" can be found, or now if you would prefer, we can move the batch approach discussion to it's own thread so that it can be found more easily by others. Cheers and Regards Quote
Geej Posted February 15, 2013 Author Posted February 15, 2013 Hi bphlptPlease feel free at your discretion to keep us appraised, be it in this thread or new topics.Since Vista and above have this kind of UAC added to the system, a general scheduler task using batch script would be very useful as generally more people understand batch better than other kind of script.Keep in view for a breakthrough... Quote
Geej Posted February 28, 2013 Author Posted February 28, 2013 Updated to 1.3.1.636b Please uninstall any existing one before install this one as uninstall routine is very different.This new one install as services, settings are now store in user's Appdata dir.Auto startup entry in HKLM...run is needed now.Cheers Quote
RicaNeaga Posted March 19, 2013 Posted March 19, 2013 Tried your latest addon in a x64 VMBox environment, and got errors, probably due to the shortcut. Screenshots attached. Also, if I start the program from its installation folder, it does start and works ok, however the startup scheduled task isn't, so if I want to use it I have to start it everytime from the installation folder, as the shortcut from start menu doesn't work. Quote
Geej Posted March 19, 2013 Author Posted March 19, 2013 I think I know what is the problem. Now I change to 'Architecture:x86'. Pls retest.('Architecture:' was set to dual but not working either as it is "blank'. So when 'blank', filecopy literally set accordingly just like !x86, i.e %programfiles%\Everything even in x64 system)Kindly download from #1 again, thanks. Quote
RicaNeaga Posted March 19, 2013 Posted March 19, 2013 (edited) Also, important info in this thread from today. It's related to the latest service and how it doesn't need admin privileges (so yeah, the UAC shortcut really isn't needed anymore). LE: Posted in the same time, going to test in about four - five hours, please take a look at the link, maybe some other changes are needed. Edited March 19, 2013 by RicaNeaga Quote
Geej Posted March 21, 2013 Author Posted March 21, 2013 Also, important info in this thread from today. It's related to the latest service and how it doesn't need admin privileges (so yeah, the UAC shortcut really isn't needed anymore). LE: Posted in the same time, going to test in about four - five hours, please take a look at the link, maybe some other changes are needed. If I read correctly, the addon should install correctly. (no changes needed) (Addon is installed as service, and program is auto startup from HKLM\...\run)Cheers Quote
RicaNeaga Posted March 21, 2013 Posted March 21, 2013 Everything works great now on x64 (addon integrated with Win Toolkit). Great work! Going to try it also on an x86 image, and post again if anything happens. But it's likely everything will be great also for x86, as only x64 was always a little problematic. Quote
RicaNeaga Posted April 13, 2013 Posted April 13, 2013 Many new beta versions were released in the last couple of days. The one from today, fixing a major bug - 1.3.2.644b. Very interesting the ''new'' ftp / htttp server support. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.