Tag Info

Hot answers tagged

10

On Windows, typically an environment variable is already set and available for you to use - echo %ComputerName%


4

You can't do this with the at command. It only allows for either EVERY Sunday or NEXT Sunday. You'll need to use Scheduled Tasks instead. Either with the gui or via cli. I'll steal this one from Hyppy as an example: SCHTASKS /Create /SC MONTHLY /MO first /D SUN /TN GameTime /TR c:\windows\system32\frecell


3

I never knew about BITSAdmin. But I found this in the manual: BITSAdmin is deprecated and is not guaranteed to be available in future versions of Windows. You could also do it without BITSadmin (and with a little help from powershell) : @echo off set ip= powershell.exe -Command (New-Object ...


2

You can use a FOR loop with findstr to find the lines beginning with "O" and then rename the files based on the text returned. Using a few files as an example: C:\temp>dir /s /b C:\temp\1.txt C:\temp\2.txt C:\temp\3.txt You can use the following command to return the text for lines beginning with "O" for all files in the current directory and any ...


2

Simple using JREPL.BAT - a hybrid JScript/batch utility that performs regular expression search and replace on text. JREPL.BAT is pure script that runs natively on any Windows machine from XP onward. Solution 1 doing some of the work with JREPL and some with batch: @echo off setlocal disableDelayedExpansion set n=0 for /f delims^=^ eol^= %%A in ( 'jrepl ...


2

You can use the start command to re-use instances of Windows file explorer. Change your batch file to: echo off start "C:\Users"


2

As Vikas Gupta has answered, you can use the pre-defined %COMPUTERNAME% environment variable that already contains the computer name. From a practical stand point, this should be all you need. However, it is possible for a batch file to over-write the value, so it is not guaranteed that the value be correct. You can use WMIC to directly read the computer ...


2

Another similar option to what Tim Brigham already suggested is to save the text below as a .reg file: Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Logoff\0] "GPO-ID"="LocalGPO" "SOM-ID"="Local" "FileSysPath"="C:\Windows\System32\GroupPolicy\User" "DisplayName"="Local ...


2

Answer 1: None, because Windows batch doesn't even have functions like bash does. It only has subroutines that use a different syntax than regular commands – ping vs call :ping – so there's no need for an override. If you read the documentation more closely, command only skips aliases and functions, but does nothing about scripts in $PATH. In ...


2

You need to quote the path to your executable: powershell -Command "& { Start-Process -FilePath 'E:\Trunk Monkey\Utilities\SkypePortable\SkypePortable.exe' }"


1

There is free software such as Ant Renamer 2 that has command line parameter options. You create an ARB file (Ant Rename Batch file) that you call from the command line. You can have it be one renaming step, or a series of steps that you want to run in sequence. You did not provide an example renaming scheme, but Ant Renamer allows you a lot of flexibility ...


1

Your "echo" stands outside of for / do - loop that is why it will be printed only once. Put it INTO the do section like this: for /f "delims=" %%s in ('dir /b /a-d /o:gen') do ( if /i "%%~xs" equ "!suffix!" ( set /a num+=1 ) else ( if !num! neq 0 echo "!suffix!" !num! set num=1 set suffix=%%~xs ) echo "%suffix%" ...


1

You can create a vbscript to play an audio file. Create a new textfile and name it something like play.vbs Your play.vbs file will look like this: Dim oPlayer Set oPlayer = CreateObject("WMPlayer.OCX") ' Play audio oPlayer.URL = "C:\welcome.mp3" oPlayer.controls.play While oPlayer.playState <> 1 ' 1 = Stopped WScript.Sleep 100 Wend ' Release the ...



Only top voted, non community-wiki answers of a minimum length are eligible