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. Yes there is and no there isn't For `Yes there is`: You place your file in the directory which contains the path starting Documents, (on Line 2)e.g. C:\Users\able72For `no there isn't`: You input in the full path within the script, (in front of Documents on line 2)e.g. C:\Users\able72\Documents\1C SoftClub\il-2 sturmovik cliffs of dover - MOD\DashPics
  2. Here's a New Year present (RandCopy.cmd) (it uses your given paths and does not use sub-directories): @Echo Off & SetLocal DisableDelayedExpansionSet "_BD=Documents\1C SoftClub\il-2 sturmovik cliffs of dover - MOD\DashPics"If "%CD%" NEq "%_BD%" PushD %_BD%||Exit/BSet "_$="For %%# In (Templates\*.tga) Do Set/A _$+=1 & For /F %%_ In ('Call Echo(%%_$%%' ) Do Set "_F[%%_]=%%#"Set/A _R=%Random% %% _$ +1Call Echo(Processing "%%_F[%_R%]%%"Call Copy "%%_F[%_R%]%%" Selected\1.tga>NulTimeout 5 1>NulYou may remove the last line if it irritates you.
  3. If the requirement is more to provide input boxes then I have attached a zipped NT Command Script, (MsgBoxes.zip), which should do that. The script should give you input boxes for your two required parameters and should work perfectly fine on your target OS without pre-configuration, third party utilities or temporary files. You place your code where I have provided an example line (between lines 5 and 7) and the created variables %_SSID% and %_PWD% will hold your input SSID and Password respectively.
  4. There-in lies your problem; if you must treat solutions in any language other that that in which you've posted as a competition then I'd suggest you simply refrain from future participation. A HTA solution was suggested, therefore to ensure you were given the greatest chance of seeing it, I moved the original Topic to this Programming Forum. Please read through my posts above and try to explain in a mature manner where I have so much as suggested that the powershell solution was better than a HTA, then when you've failed to do so perhaps an apology to myself and the readers of this group would be in order!
  5. This is beginning to be tiresome! Also, if you haven't configured your system to run powershell scripts, which incidentally does have the correct ps1 extension, then that is not within the remit of this question or solution.
  6. Why not just use this powershell script, I think it should perform exactly what you need, apart from the fact it has a fixed SSID, (can be added as a requested parameter if required). Perhaps the only thing I can see which may be useful is a quit if the number of found adapters is 0. Change Line 40 From: Write-Host -Foregroundcolor Green "Found $(($WifiAdapters | Measure ).Count + 0) wifi adapters"Change To: $NumCnt = $(($WifiAdapters | Measure).Count + 0)If ($NumCnt -eq 0) {Exit}Write-Host -Foregroundcolor Green "Found $NumCnt wifi adapters"
  7. If this is Corporate data, and you are looking for remuneration for someone else's work then provide the information or go elsewhere If you are searching the entire registry or a selection of hives then instead of making things difficult just say so. I asked for the exact search and replacement data, and you still appear to have failed to provide it! Finally, if you are, as we are guessing, intending to inject replacement paths into entire registries, (offline or otherwise), then batch scripting and/or powershell would be far from my recommendation.
  8. I am sorry, if my examples were not good enough. I found it extremely hard to explain my intentions as there were few ways to approach the matter(cmd, powershell, vb + 3rd party) and hand full of tools(3rd party) that could of been used with few different formats to process not to mention I am actually processing through over 5000 registry keys even while only handful are actually binary and having this issue which I can isolate and process separately, but I believe generic example was also needed, so, it's not restricted to singular case. [Detailed Information]==[Appropriate Assistance] I don't believe that you are doing a replace on 5000 registry keys; and since you have decided that your project detail is to be kept a secret, then even though I'm quite familiar with powershell and nt command scripting, I will be unable to provide you with the assistance you require.
  9. Your project isn't replacing data in random keys so please stop trying to confuse those willing to help by offering generic data examples. Tell us the actual registry keys you're parsing, the exact data you are looking to replace and the replacement data you are hoping to replace it with.
  10. Another possible one liner: (Untested - This may name the offending folder to HexA0) ForFiles /C "Cmd /C If @IsDir==TRUE (If @File==0x220xA00x22 Ren @File HexA0)"It may in your case not even need to check whether or not it is a directory: ForFiles /C "Cmd /C If @File==0x220xA00x22 Ren @File HexA0"Or to remove the offending directory: ForFiles /C "Cmd /C If @IsDir==TRUE (If @File==0x220xA00x22 RD/S/Q @File)"
  11. kali, you need to understand that you will not get any responsible Member here to condone what you intend to do. If the problem is with a 'nameless' directory and its content, then that is all any responsible code should be targeting; not the device containing that directory.
  12. jaclaz is correct, reckless is a fair assessment of what you are intending to do. If you are going to delete most of the executable files from my pen drive then you may as well have just formatted the thing because apart from a few pictures there'd be very little left worth keeping!
  13. See if this suits your task; (it uses the same method of only looking at the C:\Users path for profile directories) $MyFile = 'MyFile.ext'$MyDest = '\AppData\Roaming\folder\another_folder\data\stuff\'ForEach ($User In (GCI "C:\Users" -Exclude Public,Default*)) { $Null = NI -I D -F -Path "C:\Users\$($user.Name)$MyDest" Cp -Path $MyFile -Destination "C:\Users\$($user.Name)$MyDest$MyFile"}If you really do want just a fix for your script then try this; $PathToMyFile = "MyFile.ext"$UserProfiles = GWmi Win32_UserProfile -filter "LocalPath Like '%\\Users\\%'" | Select-Object -ExpandProperty LocalPathForEach ($Profile in $UserProfiles) { New-Item "$Profile\AppData\folder\another_folder\stuff\data\config" -ItemType directory Copy-Item $PathToMyFile -Destination "$Profile\AppData\folder\another_folder\stuff\data\config"}To improve the robustness that I mentioned in my opening post then you could use this instead; $PathToMyFile = "MyFile.ext"$UserProfiles = GWmi Win32_UserProfile -Filter "Special != True" | Select-Object -ExpandProperty LocalPathForEach ($Profile In $UserProfiles) { New-Item "$Profile\AppData\folder\another_folder\stuff\data\config" -ItemType Directory | Out-Null Copy-Item $PathToMyFile -Destination "$Profile\AppData\folder\another_folder\stuff\data\config"}To incorporate that robustness to my example at the head of this post then; $MyFile = 'MyFile.ext'$MyDest = '\AppData\Roaming\folder\another_folder\data\stuff\'ForEach ($User In (GWmi Win32_UserProfile -F "Special != True" | Select -Expand LocalPath)) {$Null = NI -I D -F -Path "$($User)$MyDest" Cp -Path $MyFile -Destination "$($User)$MyDest$MyFile"}
  14. I'm a little busy right now, (will return later), but just wanted to let you know that your method of identifying profile folder locations whilst possibly good for the majority of situations may not be robust enough for all scenarios. BTW Get-ChildItem accepts wildcards so you could quite easily have achieved the same as your working code like this: #Using Powershell 2.0$MyFile = 'MyFile.ext'$MyDest = '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup'GCI -Path ('C:\Users\*\' + $MyDest) | Where {$_.PSISContainer} | % {Cp -Path $MyFile -Destination $_.FullName}#Using Powershell 3.0 $MyFile = 'MyFile.ext'$MyDest = '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup'GCI -Path ('C:\Users\*\' + $MyDest) -Directory | % {Cp -Path $MyFile -Destination $_.FullName}
  15. @gunsmokingman Please take note of the quoted posts, (from this topic), below. If you wish for Mike88 to be persuaded to use a vb script, even if run as part of batch routine then you need to fulfil the requirements first.
  16. @gunsmokingman If you cannot understand that there is no benefit in making collections of all of the properties of CIM_DataFile when you only require a few of them, then you may be better advised moving forward to refrain from taking your usual path.
  17. @gunsmokingman If you're going to use the Wmi method then why Select all properties, [*], from CIM_DataFile instead of selecting just the four properties you need, [Drive Path FileName Extension]. e.g. SELECT Drive,FileName,Extension,Path FROM CIM_DataFile WHERE… <EDIT /> I'd be more tempted to use LIKE and ignore anyone using Windows 2000 Dim objWMIService, colQuery, objstrComputer = "."Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2")Set colQuery = objWMIService.ExecQuery("SELECT Extension, Name FROM " & _ "CIM_DataFile WHERE Extension = 'cmd' AND Name LIKE " & _ "'%\\OEM\\RunOnceEx\\test.cmd'")If colQuery.Count = 0 Then WScript.Echo "File not found" WScript.QuitElse For Each obj In colQuery Wscript.Echo obj.Name Next End If
  18. Just for fun! @ECHO OFFSETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION(SET _DT=\oem\runonceex\)(SET _FN=test.cmd)ECHO(&ECHO( Searching Drives for '%_DT%%_FN%'&ECHO(FOR /L %%A IN (90 -1 67) DO (CMD/C EXIT/B %%A FOR /F "TOKENS=*" %%B IN ('DIR/B/S/A-D-R-S-H/L "!=EXITCODEASCII!:\%_FN%"^ 2^>NUL^|FIND "%_DT%%_FN%"') DO (SET "_FP=%%B" SET "_TT=!_FP:%_DT%%_FN%=!" ECHO( %_DT%%_FN% Found in !_TT! [!_FP!]&ECHO())PAUSEEXIT/B
  19. Please be very careful. I would not recommend running another script based purely off a multiple drive file name search. @ECHO OFF&SETLOCAL ENABLEEXTENSIONS DISABLEDELAYEDEXPANSIONSET/P "TOFIND= Please enter the file search name: "ECHO(&ECHO( Searching Drives for '%TOFIND%'&ECHO(FOR /L %%A IN (90 -1 67) DO (CMD/C EXIT/B %%A FOR /F "TOKENS=*" %%B IN ( 'CALL DIR/B/S/A-D "%%=EXITCODEASCII%%:\%TOFIND%" 2^>NUL') DO (CALL %%B))
  20. Although not requested, here's a little script similar to that which I posted in the topic linked earlier. @ECHO OFF&SETLOCAL ENABLEEXTENSIONS DISABLEDELAYEDEXPANSIONSET/P "TOFIND= Please enter the file search name: "ECHO(&ECHO( Searching Drives for '%TOFIND%'&ECHO(FOR /L %%A IN (90 -1 67) DO (CMD/C EXIT/B %%A CALL DIR/B/S/A-D "%%=EXITCODEASCII%%:\%TOFIND%" 2>NUL)ECHO(&ECHO(Press any key to exit...&PAUSE>NULIf you wish to be able to search potential drives A: or B: change 67 to 65
  21. Thanks. Just awesome, REG_EXPAND_SZ is working. I added the command below. REG ADD %Avro_active% /v "StubPath" /d "regedit /s %WINDIR%\Avro_prof.reg" /t REG_EXPAND_SZ /f 1>nul 2>nul Will it work in XP to later OS both 32bit and 64bit? Are you sure you added the command 'in color'? The reason I ask is that the line in cmd would automatically expand %windir% when reg adding it …it should read: REG ADD … %%WINDIR%%\Avro_prof.reg
  22. Kali, please don't expect us to join another forum in order to view information pertinent to your posts here! (the links have been removed from your opening post as a result)
  23. What happens if you adjust the ping to say 10 seconds? PING -n 11 127.0.0.1 1>NULIt suggests that perhaps the handle is still open on the unloaded file and cannot therefore reload it in the loop
  24. Is anyone having issues with printing? I have a printer attached to the router and for some reason every time I go to print something I get an error with a message saying that the RPC Server is unavailable. If I right click on the printer and select troubleshoot the troubleshooter starts the Spooler service and fixes the issue, the printer prints. However even during printing the spooler can turn off again and a part printed page comes out. I didn't notice this happening previously due to no printing activity so I have no idea if its specific to this build or whether it's a deliberate act to prevent the OS being used as a main PC. Ideas…
×
×
  • Create New...