New answers tagged

0

Are you required to use batch? If you're willing to use Powershell, which has been part of the Windows OS for many years now, this is not hard to to. To see only the unique items: get-content .\input.txt | select -unique | out-file unique.txt Are you also trying to say you want to know which words are duplicated? If so, this will give you some information ...


1

I found it out now, just simply type out ./ before index.html start chrome ./index.html


0

Next commented code snippet should do the job: @ECHO OFF SETLOCAL EnableExtensions DisableDelayedExpansion rem delete auxiliary variables for /F %%G in ('set ___ 2^>NUL') do set "%%G=" rem count up number of occurrences for /F tokens^=2^ delims^=^" %%G in (' FINDSTR /C:"Widget Name=" "configure.txt" ') do set /A "___%%G+=1" rem subtract 1 to ...


-1

The easiest way to add a variable to the path without rebooting is to open the command prompt and type: PATH=(VARIABLE);%path% and press enter. To check if your variable loaded, type PATH and press enter.


1

Here's a plain and simple PowerShell solution (as an alternative to batch) gci 'C:\yourpath\yourfolder' | % { get-item $_.FullName | ? { $_.length -gt 10mb } } what we're doing here is: getting all files inside your Folder with gci iterate over all files via foreach-object alias % checking the Items File length via get-item only select the files which ...


1

List all files greater than 10MB in a given directory and its subdirectories. @echo off setlocal enabledelayedexpansion set "SEARCH_DIR=%~1" echo Usage: %~nx0 directory echo Lists all files in given directory and its subdirectories larger than 10MB. if not exist "%SEARCH_DIR%" ( echo "%SEARCH_DIR%" does not exist. exit /b 1 ) for /R "%...


-1

After checking some other topics on SuperUser, SS64, and other random sites found via Google Search I decided that I would use the 'rename' command in combinations with 'IF' and 'Else'. Nesting the 'IF' and 'Else' was not that easy to do, so I dropped the 'Else' and only used 'IF' - it worked! 'for /f %%a in ('dir /b /d *') do ( IF %%a EQU 97270 (rename "%...


1

Another option is to use a PowerShell script to replace the values; the script should be somewhat self-explanatory: (Get-Content d:\GameRender.txt) | ForEach-Object {$_ -replace "stat.score", "000099" -replace "stat.level", "0"} | Set -Content d:\GameRender.txt


0

Okey so I was able to solve this with your assistance by changing the GameRender_source.txt content to be only on 1 line. for /f "usebackq delims=@" %%a in ("%cd%\assets\GameRender\pets\cthulhu\GameRender_source.txt") do set Render=%%a call set "Render=%%Render:stat.score=!stat.score!%%" call set "Render=%%Render:stat.level=!stat.level!%%" echo:!Render!>...


0

This is a rough hack and there are probably better ways of doing this, but this should give you a starting point. First, compile a list of the files you need with this command: dir *.java /b >> dirlist.txt You can probably do this part in the script, but creating this list first allows you more control over the files you will be operating on. From ...


0

I just use sweep.exe from years ago. It runs the same command in the current directory and all subdirectories. You may have to run sweep more than once if you are looking to extract archives within an archive. You can use something like: sweep 7za x -y *.zip to open all .zip files in the current folder and all folders underneath. 7zip command line ...


0

the timeout switch is not the same as what you are looking for as a 'wait' switch. The timeout switch with Windows ping command simply tells the command window how long to wait before RECEIVING the reply, not how long to wait before sending the NEXT reply.


0

7z e -an -air!*.rar -r extracts all rar files from the current directory's sub folders (recursively) into the current folder. Change to -air!*.zip for zip files.


0

What is wrong with my syntax? xcopy "J:\Common\NY SERTIFIKATBANK\18 Buoyancy Reports\Nav Lights\534515" "534515" /I /y /r /exclusions:"K:\Temp\TO UPLOAD\0 BIJANs FILES\100 BATcreator\exclusions.txt" xcopy does not have a /exclusions option. It uses /exclude which is not a text file, but a list of files to exclude. Syntax /EXCLUDE:file1[+file2][+...


2

Save remote file list to a file; Count number of lines in the file. @echo off echo open ftp.example.com>ftp.txt echo user>>ftp.txt echo password>>ftp.txt echo ls /remote/path files.txt>>ftp.txt echo bye>>ftp.txt ftp -s:ftp.txt set /a LINES=0 for /f %%j in ('type files.txt^|find "" /v /c ') do set /a LINES=%%j del files.txt ...


0

You can use one of the solutions in this related post to convert your BAT file to an EXE. You can write a simple single page web api that increments a counter when it is hit. You can be as creative as you want in adding validation / protection here. The bat file could curl and hit that URL. None of this is foolproof. The converted exe can still be reverse ...


0

"& was unexpected at this time" error There are two mistakes in your batch file. Mistake 1: for /f "skip=1 tokens=4" %%B in ('wmic product where "name like 'Microsoft .NET%'" get name') do set "DNVER=%%B" The above command needs to have the single % after NET escaped. Use %% instead: for /f "skip=1 tokens=4" %%B in ('wmic product where "name like '...


0

In powershell it's just to lines: [xml]$XmlDocument = Get-Content -Path C:\...\test.xml $XmlDocument.GCContextualMethod.method.GC.Column.Setpoints.Flow.InitialValue | Out-File c:\temp\result.txt Save this to some script.ps1 and change the path to the real xml. The result 4.7 will be out to the txt file. Please note that in real xml file all elements like ...


0

Something like that: @echo off start /w cmd /c myapp.exe timeout 60 tasklist /FI "IMAGENAME eq myapp.exe" 2>NUL | find /I /N "myapp.exe">NUL if "%ERRORLEVEL%"=="0" (app2) else (timeout 60) Comments: timeout 60 - is 60 secs of waiting; tasklist line checks if the app has started - if yes - starts the second one, if not - adds one more minute timeout.


1

It is probably easier to create a task in Task Scheduler and execute the .exe directly. Based upon the screen shot below, 2 options could suffice, either When the computer starts or When I log on To find it, click the Windows menu (start menu) and type in task s and it should appear in the list


0

Problem : - Startup physical machine and automatic launch of VMs by sheduled task - login later on with my mainaccount (days or weeks later...no matter) - start "cmd", typing "vboxmanage list runningvms" does not showup any vms My solution : 1- first open the component service DCOM 2- edit the highlighted component as followed : upon 2- enter the ...


1

If you are absolutely confident that writing folders in C:\Windows\system32\ is a good idea (probably not, but YMMV), and you don't want the File System Redirector to automatically redirect your file, and you must write with a 32-bit process, then use the path C:\Windows\sysnative\ and it will write out to the system32 folder. Caution: it's probably not a ...


0

Might be an easier way, but I just sent a keystroke for CTRL+N for a new window before sending the next start command. This works for me. (save as a .ps1 for powershell) start microsoft-edge:http://google.com $wshell = New-Object -ComObject wscript.shell; $wshell.AppActivate('Google - Microsoft Edge') Sleep 2 $wshell.SendKeys('(^(n))') Sleep 2 start ...


2

You can use the program VDesk to achieve this functionality. VDesk for Windows 10: launch programs on virtual desktops Vdesk is a portable program for Windows that adds the feature to Windows 10. It is a command line program but ships with an option to integrate its functionality in File Explorer. The main command looks like this: vdesk [n]...


0

This is not a batch style solution, but it can be useful. There is a software where you can specify certain criteria to rename lots of files. This software is free for home use, is called Bulk Rename Utility


0

I am not sure as how to move all at once, but You can try below command move /Y c:\PICS\ASF\photos*.jpg c:\PICS\ASF\ Note :: you will need to rename folder name in source and destination as below. move /Y c:\PICS\DFS\photos*.jpg c:\PICS\DFS\ move /Y c:\PICS\HGD\photos*.jpg c:\PICS\HGD\ move /Y c:\PICS\FTG\photos*.jpg c:\PICS\FTG\ Hope this helps.


1

type file1.txt file2.txt > file3.txt Edit: Try this for the newline part: echo. > newline.txt type file1.txt newline.txt file2.txt > file3.txt del newline.txt


0

The utility "CMDOW Commandline Window Utility" would probably work as well, in conjunction with a control batch file to open and position the browser windows. http://www.commandline.co.uk/cmdow/ I wrote a fairly involved batch file that would open/rename/relocate DOS-type command windows. Each DOS window represented an instance of a streaming audio capture ...


3

A basic batch file for connecting to SFTP server with WinSCP scripting is like: winscp.com /log=c:\writable\path\winscp.log /ini=nul /command ^ "open sftp://username:password@example.com/ -hostkey=""...""" ^ "some command like put for upload" ^ "exit" For details, see a guide to Automating file transfers to SFTP server. For the -hostkey ...


1

If status is detached then don't write the block "type, date and status" This is easy to do using an if command. Replace: echo %%c|find "more">nul && set "status=not granted" echo %%c|find "detached" >nul && set status="" echo type: !type! echo status: !status! echo date: !date! echo. With: if "!status!" NEQ "detached" ( echo ...


0

I want a new file with all the important data I've modified your batch file to produce the results you want. Use the following batch file (test.cmd): @echo off setlocal EnableDelayedExpansion if exist result.csv del result.csv for %%f in (file*.txt) do ( set _line= rem we don't need the first 2 lines so skip them rem we only need the data after the :...



Top 50 recent answers are included