Content Type
Profiles
Forums
Events
Everything posted by Yzöwl
-
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.
-
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"
-
Get first letter of drive
Yzöwl replied to sweept's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
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 -
Format output commandlines from cmd
Yzöwl replied to xtremee's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
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 ^^. -
Format output commandlines from cmd
Yzöwl replied to xtremee's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
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. -
Can you not just request one by sending an email to inbox@google.com from your Google account?
-
Help to Create a .vbs Script
Yzöwl replied to onlyrasel's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
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. -
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.
-
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?
-
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
- 2 replies
-
- Batch
- batch-scripting
-
(and 4 more)
Tagged with:
-
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
-
Well how about NUniExtract, 'new nee extract' (new UniExtract).
-
Help make CMD install on XP x86 only
Yzöwl replied to ricktendo's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
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 -
Batch File Not Working
Yzöwl replied to ghosttracer's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
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.- 27 replies
-
- batch files
- not working
-
(and 2 more)
Tagged with:
-
Batch File Not Working
Yzöwl replied to ghosttracer's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
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- 27 replies
-
- batch files
- not working
-
(and 2 more)
Tagged with:
-
Batch File Not Working
Yzöwl replied to ghosttracer's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
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- 27 replies
-
- batch files
- not working
-
(and 2 more)
Tagged with:
-
Batch File Not Working
Yzöwl replied to ghosttracer's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
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- 27 replies
-
- batch files
- not working
-
(and 2 more)
Tagged with:
-
Batch File Not Working
Yzöwl replied to ghosttracer's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
@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!- 27 replies
-
- batch files
- not working
-
(and 2 more)
Tagged with: