Tag Info

Hot answers tagged

2

Solution The problem lies in the following line of code: move "Default Programs.lnk" "C:\ProgramData\Microsoft\Windows\Start Menu\System\Settings" As pointed out by @Scott, the destination path is wrong. In particular: Start Menu\System That part should read: Start Menu\Programs\System Remarks Even if you were able to solve the problem, there are ...


2

The following simple script will rename all .jpg files in the current folder to random 8 character alphanumeric names, preserving the .jpg extension. Note that it is possible for the random name generator to produce a name that already exists, so the script loops until it successfully generates a unique name. @echo off setlocal disableDelayedExpansion set ...


2

I've got to believe this has been asked and answered before. But here is a simple batch script that can do the job. ::StringCount String File :: :: Count the number of times that String appears in File. :: The search is not case sensitive. :: Enclosing quotes are not considered to be part of the string. :: The string cannot contain = :: @echo off ...


2

You can do this in the Windows Task Scheduler. Once in the Task Scheduler navigate to the menu and go to Action -> Create Task In the General tab you have to set a name, privileges and configuration options. In the Triggers tab you will have to create a new trigger for At Logon for all or a specific user Finally, you have to create a new action ...


1

After playing with this for a while, I came up with this working solution: @echo off rem collect the filenames dir /s /b "G:\Test-folder\ab*" >"G:\Test-folder\list.txt" rem process each file for /f "usebackq delims=" %%f in ("G:\Test-folder\list.txt") do call :work "%%~f" @echo. rem Note: I still could not make this work with "setlocal ...


1

Kudos to you for discovering two obscure Windows batch behaviors in one Q and A! It is impossible to pass an odd number of quoted carets as a string literal through CALL in either batch or command line. An explanation can be found in Phase 6) at How does the Windows Command Interpreter (CMD.EXE) parse scripts?. Here is an example of the problem. Suppose a ...


1

The Task Scheduler window doesn't automatically refresh, which could lead you to believe it's still running. Clicking the Refresh link on the right side panel should hopefully show it change.


1

That will not be possible. Once a variable is assigned a value, it is no longer dependent on the variable or text that was used when assigned. The easiest way to achieve your desired output is to simply echo the VA variable and the text at the end. Basically, do all your computations, then at the end put together your output. @echo off setlocal ...


1

After some more searches, I solved it myself using the following commands: set parentfolder=%APPDATA%\Mozilla\Firefox\Profiles\ for /f "tokens=*" %%a in ('"dir /b "%parentfolder%"|findstr ".*\.ABC""') do set folder=%%a For deleting the contents, I used: RMDIR "%APPDATA%\Mozilla\Firefox\Profiles\%folder%" /s /q mkdir ...


1

Unfortunately this answer doesn't do any "searching", but your file could be easily re-written in a small number of lines, so it may be easier to re-write the file contents...? set /p ID="Enter Number: " @echo off @echo var i;> javascript.js @echo for (i = 1; i ^<^= %ID%; i++)>> javascript.js @echo {>> javascript.js @echo iimSet("loop", ...


1

That vbscript file you give in your question works You could say set /p yyy=input number: or %ID% as you have. Below I change i <= 4, to i <= %yyy% yyy=44 so it becomes i <= 44 C:\blah>type a.a var i; for (i = 1; i <= 4; i++) { iimSet("loop", i); iimPlay("ABC.iim"); } C:\blah>set yyy=44 C:\blah>replace a.a "i <= 4" "i <= ...


1

This c:\> for /? ... will list how for works, look for the line FOR /F ["options"] %variable IN (`command`) DO command [command-parameters] and read about it. Now note that %variable is LOCAL to for so you need to have e.g. set F=%variable within command C:\> for /F "usebackq" %v in (`echo Check-it-out`) do @ set F=%v C:\> echo To do: %F% ...


1

The line copy *.* "%userprofile%\Documents\test1\" /Y makes the batch copy data not from the directory it is stored in, but from the directory it is called from. Insert cd /d %~dp0% after the first line, to make the latter directory be the former.


1

Yes this is possible with a little bit of scripting. $adaptor = Get-WmiObject -Class Win32_NetworkAdapter | Where-Object {$_.Name -like "*Intel(R) 82567LM-2 Gigabit Network Connection*"} $ssrunning = (Get-Process -name notepad -ErrorAction SilentlyContinue) if ($ssrunning){$adaptor.Disable()} else{$adaptor.Enable()} Its actually easier in Windows 8.1 ...


1

cmd chains to a batch file, ie the called batch file replaces the calling batch file and does not return, so any calls after the batch call will never be seen. If you want to return from a batch file you must use the call command, as in: echo %date%, %time%: Deploying web site to Test1. > deploy.bat.log call Hello.bat start "" notepad.exe deploy.bat.log ...


1

Would the computer's hostname be sufficient, instead of IP Address? IF %COMPUTERNAME% NEQ NetBIOSPC (wmic nicconfig where (TcpipNetbiosOptions!=null and TcpipNetbiosOptions!=2) call SetTcpipNetbios 2) Obviously, replace NetBIOSPC with the actual hostname of the system. Be sure you're using the right hostname by typing hostname or echo %COMPUTERNAME% at ...


1

You can pipe the file name through sed -e's/%\([0-9A-F][0-9A-F]\)/\\\\\x\1/g' | xargs echo -e


1

The best way I've found to do this is to set the title on a batch script. From there you can use tasklist to query the count of running processes by the title name. The below code snippet anything below process_count=2 means the process is not running, 3 means exactly 1 instance is running, and if above 3, there's more than 3 processes running. Hackish, ...


1

Copy the contents of the cmd window and past it into Word, or other text editor. See Microsoft's documentation on how to copy text from a command prompt window.


1

You can make a commandlet. Create a new text file type into the text file (you may have to use quotes if the path to the .hta has spaces) %windDir%\system32\mshta.exe "FULLPATH_OF_HTA\FILENAME.hta" save the text file change the extention from .txt to .cmd now you can right click and run as admin or shift right click to run as other user. you can also ...


1

Alwayse quote the paths. paths with space in name must quote. use this : cd "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\System" mkdir Settings cd "C:\ProgramData\Microsoft\Windows\Start Menu" dir move "Default Programs.lnk" "C:\ProgramData\Microsoft\Windows\Start Menu\System\Settings" pause



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