# Tag Info

0

use "start": c:>start c:\xampp\mysql\bin\mysqld --defaults-file=c:\xampp\mysql\bin\my.ini Tested alone and inside a .bat; I am on Windows 8.1 but I expected it works on Windows 7 too

0

The below works for me, although taskkill no longer seems to work as it did previously. The CMD window says the kill command was successfully sent, but VLC doesn't close. ﻿﻿echo rem choice /c YN /n /d Y /t 120 taskkill /im vlc.exe ping localhost -n 10 > nul start /max "" "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --loop -vvv myplaylist.pls

4

If your path contains spaces - you have to enclose whole path with ", like this: copy "C:\Program Files (x86)\...\FifthGenerationMage.bsa" "C:\Users\...\DATA" I would also suggest to use variable to store target path and simplify script: set skyrimdata="C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data" set target="C:\Users\Mark ...

0

Suppose you want to write count: 1 to a file. For Windows, echo count: 1>file.txt will write count : to the file (without the 1) because the 1 is interpreted to mean stdout. You could use echo count: 1 >file.txt, but then there is an unwanted trailing space. Placing the redirection at the front avoids the problem: >file.txt echo count: 1. Not ...

0

Is there anyway to modify this new behavior? Problem: I run tcc scripts. Sometimes in the tcc script, I use cmd to launch an app with a clean environment. So now I get a new conemu tab AND the tab won't always go away because it complains the session lasted less that 10 sec. I launch cmd with the /min flag so I basically never saw the console before this ...

2

For such simple examples it does not matter where the redirection happens. It's a choice of coding style here. The Bash manual states: The (...) redirection operators may precede or appear anywhere within a simple command or may follow a command. What is a simple command? A simple command is the kind of command encountered most often. It’s just a ...

0

WMIC uses a SQL dialect. An empty string (0 length string) is not the same as NULL (no value). wmic nicconfig where "MACAddress is not null" get ...

0

Based on the image you posted, the batch file itself is generating the error, not the operating system. This tells me that something inside of the batch file is trying to access an area that either does not exist, or that you do not have access to. The other things I am thinking of are that you may have scripts disabled on your computer, or you do not have ...

1

click on ANY batch file and see the output Click where? Have you enabled DefaultTerminal feature? It has a confirm option.

1

Try with this using PowerShell, in this example I want to delete all the .class files: Get-ChildItem '.\FOLDERNAME' -include *.class -recurse | foreach ($_) {remove-item$_.FullName}

3

start has a weird syntax where the first string in quotes is the new (console) window title. Your command is quoted, so start interprets it as the title, and doesn't know what /s is. So, add a dummy title, like this: START /WAIT "" "%userprofile%\desktop\jre-8u25-windows-i586.exe" /s

0

It looks like the problem is related to the hyphen after the 3 digit prefix. If I include the hyphen in the command, the results are correct: Results without hyphen(includes 106 prefixed file): D:\>dir 100*.sql Directory of D:\ 10/17/2014 11:07 AM 22,716 100-20141017-120703.sql 10/20/2014 02:07 PM 1,761 100-20141020-150709.sql ...

4

Considering this is proper behavior request. So build 141117 forces start cmd into new ConEmu tab.

0

You could try Rob van der Woude's GetUninstall.bat or GetUninstall.vbs. For the batch file, just provide part of the program name thusly getuninstall.bat chrome (no quotes, from a command line), and it will find matching entries, plus provide the uninstall string if applicable. For the VBScript, it's slightly different, but results are the same: cscript ...

0

Here is a one line solution using powershell in a batch file: Powershell -noprofile -nologo -command Write-Output "atbtc" the `t is the tab character

0

@echo off setlocal enableextensions disabledelayedexpansion set /p "number=Please enter the starting control number:" || goto :eof for /f "delims=" %%a in ('dir /b *.pdf') do ( setlocal enabledelayedexpansion for %%b in (!number!) do ( endlocal echo ren "%%~fa" %%b ) set /a "number+=1" ...

0

This has been tested in Windows 7 Professional. No error checking of any kind is performed. It renames the files in the current directory, so the script should be somewhere on your path. @echo off set /p start=Please enter the starting control number: setlocal enableDelayedExpansion for /r %%g in (*.pdf) do (call :RenameIt %%g) goto :eof goto :exit ...

0

Reference Syntax : Escape Characters, Delimiters and Quotes ^ Escape character. Adding the escape character before a command symbol allows it to be treated as ordinary text. When piping or redirecting any of these characters you should prefix with the escape character: & \ < > ^ | ^\ ^& ^| ^> ^< ^^ So in the Windows ...

3

You are correct. The ampersand is a special character in the windows command line. Typically to escape it you use the caret (^), or double quotes. If neither of those work (or if you aren't actually typing your password on the command line) I would suggest just changing your password. For example: C:\Windows\System32>echo a&b a 'b' is not recognized ...

3

"I'd like to find specific these .exe files generated and copy them to a specific bin location." Using a batch file: cd \mydir for /r %%a in (*.exe) do xcopy "%%a" \bin /i From the command line: cd \mydir for /r %a in (*.exe) do xcopy "%a" \bin /i To match release_win_64\*.exe as wildcard Using a batch file: cd \mydir for /f %%a in ('dir /b /s ...

0

I have written this batch script and put it on my Gist Repo. It requires Windows Scripting Host access. Here is the file: @set @junk=1 /* @echo off cscript //nologo //E:jscript %0 %* goto :eof */ var args=WScript.Arguments, shell=WScript.CreateObject("WScript.Shell"), bForced=false, nStartIndex=-1; ...

0

Enclose the path reference in quotation marks: FOR /d %A IN ("e:\corporate folder\*") DO mkdir "%A\2015"

1

Use Windows Server 2003 Resource Kit Tools NTRIGHTS –r SeShutdownPrivilege –u "<User or Group>" How To Disable/Remove Shutdown From Windows 7 / Vista / XP cmd: reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoClose /t REG_DWORD /d 1 /f reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v ...

0

how to make your script, to copy 1 file into 2 different destination. but the file is not copied on folder 2. What I did is: @echo off set hh=%time:~-11,2% set /a hh=%hh%+100 set hh=%hh:~1% set dateseed=%date:~10,4%%date:~4,2%%date:~7,2%_%hh%%time:~3,2%%time:~6,2% if not exist "c:\backups\source\%dateseed%" mkdir "c:\backups\source\%dateseed%" cd ...

0

According to this URL it is possible to do this via: netsh in ip add address "Local Area Connection" 172.16.1.2 255.255.0.0 (netsh int ip add rather than netsh int ip set).

2

Use startup or logon script. Group Policy allows you to associate one or more scripting files with four triggered events: Computer startup / shutdown and/or User logon / logoff. You can use Windows PowerShell scripts, or author scripts in any other language supported by the client computer. I think it accepts batch scripts as well... The procedure might ...

2

Right click My Computer, choose Manage. Under "Computer Management (Local)" to to System Tools -> Task Scheduler -> Task Scheduler Library. Right click and choose Create Basic Task. Give it a name, description, whatever. Click next, then for the trigger choose "When the computer starts". Click next. Under the Action, choose "Start a program" and click ...

-1

Put a link to the item to be run in the startup folder; Windows will run it on startup. For more advanced automation options, use Windows Task Scheduler. Source: http://windows.microsoft.com/en-us/windows/run-program-automatically-windows-starts#1TC=windows-7

1

Assuming that you are not logging into a domain Create a file called "login.bat" containing the following command. net use g: \\foo\bar You may save this in the user's profile (eg: c:\users\username\documents) Under the account properties point "Login Script:" under User Profile to c:\users\username\documents\login.bat. This may be found by doing the ...

2

Use set /P to get the user's input into a variable, then run the variable as if it's a command: @echo off set /P CommandVar=Command? %CommandVar% From set /?: The /P switch allows you to set the value of a variable to a line of input entered by the user. Displays the specified promptString before reading the line of input. The promptString can be ...

0

There are hints for command line (and we can transform it to PowerShell): start with wmic path Win32_VideoController wmic path Win32_VideoController get VideoModeDescription wmic path Win32_VideoController get CurrentHorizontalResolution wmic path Win32_VideoController get CurrentVerticalResolution wmic path Win32_VideoController get CurrentNumberOfColors ...

0

Try: start "Chrome" chrome --new-window javascript:window.open("example.com");

0

Try this, it is called Application Mode, and will remove any toolbars: start "Chrome" chrome --app=http://example.com/ Note this will also remove the address bar.

1

CHOICE /C ABCDN /N /T 10 /D C /M "CHOICE A, B, C, D or None?" IF ERRORLEVEL 1 SET val=A IF ERRORLEVEL 2 SET val=B IF ERRORLEVEL 3 SET val=C IF ERRORLEVEL 4 SET val=D IF ERRORLEVEL 5 SET val=None @ECHO You chose %val%

0

To remove All Loopback adaptors devcon /r remove =net "@ROOT\NET\*" where =net is a class @ROOT\NET\* is wildcard for all IDs of the adapters. To show the name of the adapters write: devcon status =net "@ROOT\NET\*"

0

In the end I side-stepped this issue by using DirClean. It seems to be no longer developed, and its page has gone dead, but it works just fine.

0

When you load a hive using reg load it loads that file into the key specified on the command line, in this case HKLM\temphive. So you should be adding the key to a descendant of HKLM\temphive, such as: Reg ADD HKLM\temphive\system\CurrentControlSet\Services\MountMgr /v NoAutoMount /t REG_SZ /d 0x1 And the quote from the relevant help info (reg load /?): ...

4

Batch file name itself (with full path) is available as parameter 0. Together with modifiers, it allows you to extract the path: echo "%~dp0" will just print it, but of course you may use it wherever you want (ie concatenate with second batch name and call). %0 is parameter 0 ~ is modifier 'escape' (it also removes quotes) d is drive letter p is path. You ...

0

From your first batch file you can unhide your second batch file with the command ATTRIB MySecondFile.BAT -H It doesn't matter how many times you run this command, it will leave the second batch file unhidden.

0

I had the same question, but motivated by the desire to aid my efforts to finish off malware cleanup operations. Here's the command script I wrote with an eye toward modularization so it could be extended easily for future OSes and temp file locations (I wrote this before learning PowerShell and haven't bothered to update it). Because it accesses every ...

-1

It's working as expected. The pause statement just waits for input. The only switch is to hide the fact it's waiting for a keypress. When I run the last batch file you showed, I see this: C:\Users\asdf\Desktop>more test.bat @echo off echo Hello! pause echo Hi again! pause pause echo HEY HEY!! pause C:\Users\asdf\Desktop>test Hello! Press any key to ...

0

It looks like you would like to run multiple batch files sequentially from your master batch file. You can save your batch files like file1.bat file2.bat and your master batch file as master.bat run the other batch files in your master file sequentially as echo calling sequential process 1 call file1.bat echo calling sequential process 2 call file2.bat ...

1

To get started, please use the term "Commands" instead of "Codes". So I just need to add call to the start of the batch codes and each different code saved in one file with execute one after the other sequentially simply by adding call to the start of the code? In general, yes that's right. A batch file runs a series of commands in order. Add your ...

0

1) Do not give it into HKEY_LOCAL_MACHINE, but into HKEY_CURRENT_USER. Keys under HKLM are running after system load, HKCU keys are running after user logon. 2) For delay the execution (if you need internet connection), give at the first position ping -n 10 127.0.0.1>nul for 10 second delay.

0

I don't want 5 separate files.. But just one batch file ... It's not clear what you mean by this.  If you want to have one batch file that does the functions of the five existing files, you can probably just concatenate them with copy aaa.bat+bbb.bat+ccc.bat+ddd.bat+eee.bat alphabet_soup.bat and then check the combined file for things like the ...

1

Consider you have three batch files aaa.bat bbb.bat ccc.bat you can create separate batch file ddd.bat and the content of the file should be like call aaa.bat call bbb.bat call ccc.bat This will run multiple batch file in a sequence way Hope this helps!

Top 50 recent answers are included