Jump to content

Yzöwl

Patron
  • Posts

    4,113
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United Kingdom

Everything posted by Yzöwl

  1. You could try this! @ECHO OFF & SETLOCAL ENABLEEXTENSIONSSET "_UPPS="FOR /F "USEBACKQ TOKENS=2 DELIMS==" %%A IN (`WMIC USERACCOUNT WHERE^ "DISABLED='FALSE' AND LOCALACCOUNT='TRUE' AND STATUS='OK'" GET SID /VALUE` ) DO (FOR /F "USEBACKQ TOKENS=1* DELIMS==" %%B IN (` WMIC PATH WIN32_USERPROFILE WHERE^ "SID='%%A' AND SPECIAL='FALSE'" GET LOCALPATH /VALUE 2^>NUL`) DO ( IF %%~dC' NEQ ' (CALL SET _UPPS=%%_UPPS%% "%%~C")))IF NOT DEFINED _UPPS GOTO :EOFSET _CRK=Software\OmicronLab\Avro KeyboardFOR %%A IN (%_UPPS%) DO (REG LOAD "HKU\_" "%%~A\NTUSER.DAT" REG ADD "HKU\_\%_CRK%" /V ChangeInputLocale /D YES /F>NUL REG UNLOAD "HKU\_" PING -n 4 127.0.0.1 1>NUL)You may not need the ping command at the last line or you may need to adjust it depending upon any delay between unloading one dat file and loading the next dat file. Also be very careful, corruption of this file could prevent your users from logging in.
  2. I tried it many times before and tried again as your advised. As jaclaz has alluded to, it appears therefore that you are not running the script with Administrator privileges, but when actually logged on as the Administrator If you use this script it should give open a text file listing one or more of the replacement(s) you'll need instead of HKCU in my last example script. @Echo Off & SetLocalType Nul>"%~dp0SIDs.txt"For /F "UseBackQ Tokens=2 Delims==" %%A In ( `WMIC UserAccount WHERE "Disabled='FALSE' AND Status='OK'" Get SID /Value` ) Do Echo(HKU\%%A>>"%~dp0SIDs.txt"Start "" "%~dp0SIDs.txt"
  3. Instead of using regedit, have you tried it using reg.exe? @REG ADD "HKCU\Software\OmicronLab\Avro Keyboard" /V ChangeInputLocale /D YES /F
  4. I wouldn't even bother with the "If Defined", just make sure the command is only outputting lines containing drive letters! @Echo OffSetLocalFor /F "Delims=" %%A In ('FindStr [A-Z]:\\ "%~dp0paths.txt"') Do ( Set "drive=%%~dA" Call Set "drive=%%drive:~,1%%" Call Echo( %%drive%%)PauseOr, instead of using drive letter expansion, just look for the letter preceeding the first colon (:) @Echo OffSetLocalFor /F "Delims=:" %%A In ('FindStr [A-Z]:\\ "%~dp0paths.txt"') Do ( Set "drive=%%~A" Call Set "drive=%%drive:~-1%%" Call Echo( %%drive%%)Pause
  5. The word echo need not be followed by the dot character, there are a few characters which are deemed to do the same, some even better. It is believed that the best character is an opening parenthesis, (, then possibly an equals symbol, =, then maybe a forward slash, /. More often than not you will not be able to tell any difference but some crazy batch guys over the years have argued their case and found less chance of errors with certain characters. So echo( creates an empty line; as does echo. and echo= and echo/ The circumflex character ^ is used as an escape character. As used in the output you were receiving, it was being used as a concatenation character because it was escaping the line feed; hence the reason your output was showing on one line. In order to output the required lines I had to escape the escape character, thus doubling it ^^.
  6. If you know what your required output is and you are writing the batch file yourself then just write the batch file properly. @echo/echo.curl -1 -X GET^^@echo/ --cert signedIn.pem^^@echo/ --header "Accept-Charset:UTF-8"^^@echo/ --header "Accept:application/gooleMaps_v3_1_0+xml;charset=utf-8"^^@echo/ --header "Accept-Encoding: deflate"@pauseOf course that would be too easy and is likely not the answer you want, is it? …that's because, as is often the case, my guess is that echo is not the command you are really running. That command is a secret; (the sort of secret which will prevent us from providing you with a solution). So if I am correct, please save us all from pages full of answers of wasted guesswork in trying to help you and just tell us the real command and what you intend to do with the real output.
  7. Because I'm feeling generous, you're going to be offered one more chance… Either post the script you are using and a full explanation of its output and your intentions for its expansion into powershell or I close the Topic and any further Topics you open with the same inane ramblings.
  8. The script which is generating the output text/ID may be able3 to be expanded to incorporate the new requirement or be re-written to merge both tasks into a single new script.
  9. No… …not unless you learn to post your question in the appropriate location on the forum and include pertinent detail to enable interested parties to attempt to help you!
  10. Can you not just request one by sending an email to inbox@google.com from your Google account?
  11. This is not a job for a script, you can do this quickly in the GUI. Stop your process, then do a search in Windows Explorer under the affected drive for lpk.dll. When the search is completed, select all and delete.
  12. And in Command Prompt:
  13. Try something like this: @ECHO OFF & SETLOCAL:LOOPSET "_CNT=0"FOR /L %%A IN (100,1,115) DO ( PING -n 2 192.168.1.%%A|FIND "TTL=">NUL && SET/A _CNT+=1)IF %_CNT% NEQ 1 (TIMEOUT /T 300 /NOBREAK>NUL) ELSE ( RUNDLL32 POWRPROF.DLL,SETSUSPENDSTATE 0,1,0)GOTO :LOOP<Edit> or perhaps: @ECHO OFF & SETLOCAL:LOOPSET "_CNT=0"FOR /L %%A IN (100,1,115) DO ( PING -n 2 192.168.1.%%A|FIND "TTL=">NUL && SET/A _CNT+=1)IF %_CNT% EQU 1 RUNDLL32 POWRPROF.DLL,SETSUSPENDSTATE 0,1,0TIMEOUT /T 300 /NOBREAK>NULGOTO :LOOP </Edit> Hope it helps.
  14. Firstly, is there a particular reason why you thought it a good idea to make this topic in this area of the Forums? Secondly, since you couldn't be bothered following up on the question you asked one month ago, what gives you the impression that people will be motivated into providing you with advice this time?
  15. Sometimes it's more fun to use powershell! InBTween.ps1 $ScriptPath = Split-Path $MyInvocation.MyCommand.Path$ScriptName = $MyInvocation.MyCommand.NamePush-Location $ScriptPath$ToDate = [DateTime]::TodayWrite-Host 'Today is' $ToDate.ToShortDateString()$FromDate = Read-Host 'Enter a Search From Date'If (($FromDate -as [DateTime]) -ne $null) { $FromDate = [DateTime]::Parse($FromDate) GCI . -exclude $ScriptName -rec | Sort CreationTime | Where { $_.CreationTime -ge $FromDate -and $_.CreationTime -le $ToDate } | % {$_.CreationTime.ToShortDateString() + "`t" + $_.FullName } | Tee results.txt} Else { 'You did not enter a valid date!'}Write-Host "Press any key to exit . . . " -ForegroundColor Yellow$X = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")Pop-LocationThis script is designed to search from the root of its own directory tree and the output will be written to a new file in that directory named results.txt. If the script doesn't run, you may need to type the following into a powershell window first: Set-ExecutionPolicy RemoteSigned
  16. Unfortunately I am unsure as to your requirements! Are you trying to increment? or change/replace? the hex value held in the ClientId by a specific number. Is that number known/fixed? or is it based upon the value data returned from the ServerAddress key?
  17. Just from a quick peruse of your batch code, I have already identified an error! change echo/|set /p =%date% @ & %time/tto echo/|set /p =%date% @ & time/tAlso if the file is intended for Windows 8.1, would it not be prudent to begin with an OS check first? example: VER|FIND " 6.3.">NUL||GOTO :EOF
  18. Well how about NUniExtract, 'new nee extract' (new UniExtract).
  19. What about something like this instead? FOR /F "TOKENS=2 DELIMS=[]" %%A IN ('VER') DO FOR /F "TOKENS=3 DELIMS=." %%B IN ("%%A") DO IF %%B NEQ 2600 GOTO :NOTXP
  20. I'll look forward to your test results! Perhaps we should have a look too at just identifying anything less than 6.0. I say that because 5.1 is the only system which needs treating differently by ghosttracer. 5.1 doesn't need the hibernation, (6.0 and above needs to be run as administrator), 5.1 needs a Set /p construct whereas choice.exe may be preferable from 6.0. They are then running a detection batch to load one of two scripts, pre_vista.cmd and post_vista.cmd.
  21. To be truthful I have no idea if switching If and Set for Call would optimize the code any more than nesting another For loop would For /f "tokens=2 delims=[" %%A In ('Ver') Do (For /f "tokens=2" %%B In ("%%~nA" ) Do GoTo :W%%B)The trouble however in these instances is that you'll need to still code sections for all versions outputs prior to 5.1 which may effectively negate any optimization. You would of course need to already know that the OS firstly has WMIC installed and I'd guess that the time to initialize the WMIC executable would effectively rule it out as optimization.Also remember that the rare but possible Whistler Server releases have completely different version numbering systems: Whistler Server Preview Version 2250Whistler Server alpha Version 2257Whistler Server interim release Version 2267Whistler Server interim release Version 2410
  22. Well, if you want to play that game, it could possibly be further optimized as:What about:@Echo off & Setlocal EnableExtensionsFor /f "tokens=1-2 delims=." %%A In ('Ver') Do Set _=%%A.%%BIf %_:~-2,1% Equ . (If %_:~-3% GEq 5.1 GoTo :W%_:~-3%)Echo= Unknown or Unsupported Operating System detectedPing -n 6 127.0.0.1 >Nul & GoTo :EOF:W6.3RunAs /User:Administrator Win_81.cmdGoTo :EOF:W6.2RunAs /User:Administrator Win_8_2K12.cmdGoTo :EOF:W6.1RunAs /User:Administrator Win_7_2K8R2.cmdGoTo :EOF:W6.0RunAs /User:Administrator Win_Vista_2K8.cmdGoTo :EOF:W5.1Win_XP_2K3.cmd
  23. My suggestion is to create a simple script which determines the OS and run that first to call one of a series of scripts designed for the resultant version. e.g. @ECHO OFF & SETLOCAL ENABLEEXTENSIONSSET "_OSV="FOR /F "TOKENS=1* DELIMS=[" %%A IN ('VER') DO (SET "_OSV=%%B" CALL SET "_OSV=%%_OSV:* =%%" & CALL SET "_OSV=%%_OSV:~,3%%")IF %_OSV% LSS 5.1 (GOTO :EOF) ELSE ( IF %_OSV% LSS 6 (GOTO XP2K3) ELSE ( IF %_OSV% LSS 6.1 (GOTO VST2K8) ELSE ( IF %_OSV% LSS 6.2 (GOTO W72K8R2) ELSE ( IF %_OSV% LSS 6.3 (GOTO W82K12)))))Win_81.cmdGOTO :EOF:W82K12Win_8_2K12.cmdGOTO :EOF:W72K8R2Win_7_2K8R2.cmdGOTO :EOF:VST2K8Win_Vista_2K8.cmdGOTO :EOF:XP2K3Win_XP_2K3.cmd
  24. @ghosttracer, Have you tried running the script 'as Administrator' Please take note of bphlpt's post above, I shouldn't have to edit another of your posts for that reason again!
×
×
  • Create New...