Hot answers tagged

2

Cannot use dot before redirect to file in batch file I cannot tell why the context of an if would change my ability to run the same code. You have to escape the () open and closed parenthesis characters in the ECHO command with the ^ caret character (see below) so it'll be: @echo The build FAILED because of a lock on the 'classes' folder ^(or its ...


2

One way is to store the command(s) you want to pass to cmd in a batch file, then call the batch file instead of cmd. Eg, file.bat: wmic product where name="xxx" call uninstall /nointeractive Then call the script the same way you were attempting to, powershell.exe -Command "Start-Process file.bat -Verb RunAs"


2

Use Powershell: Get-ChildItem .\*\* Edit: Above example indeed only gets the 2nd level or directories and not contents of subfolders. @guest's answer is the better one: Get-ChildItem -Directory | ForEach-Object {Get-ChildItem -Recurse | Select-Object FullName}


1

You mention Process Explorer - is that the sysinternals one? If so locate the process in the main window, right click on it and choose "Suspend" From the help file: If you want a process to become temporarily inactive, so that a system resource such as network, CPU or disk, becomes available for other processes, you can suspend the process. ...


1

You could capture the PID of the process to call or the file to open with WMIC and set the process ID number to a variable, and then later use that variable with TASKKILL using the /PID switch which I posted the example batch script below and then another below that based on your logic how I think this needs to fit into it but adjust accordingly as needed. ...


1

From set /?: SET /P variable=[promptString] The prompt you want to display for the set /p goes after the equals sign. So: echo Please enter the IP Address to TELNET set /p IP_Addr=IP Address:


1

There are multiple solutions, which I will try to explain one by one. Batch 1) for /d %i in (*) do @dir /b /s "%i" (*) expands to all files in current directory. for /d then loops through all directories, excluding regular files, executing dir /b /s for each directory. Since for echos executed commands, @ is used to suppress the echo. 2) for /f "delims=" %...


1

How I can reverse these changes? You can reverse the changes by setting the permission entry is set to [1 17] which is Administrators Full Access and SYSTEM Full Access. Create a file (for example unblock.txt) with the following contents: HKEY_CLASSES_ROOT\Applications\cmd.exe [1 17] HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\cmd.exe [1 17] ...


1

I'm not sure what is meant to go in the parenthesis where I have (".m2v"). what does that represent? for %%a in (".m2v") do ffmpeg -i "%%~na.wav" -i "%%~na.m2v" -acodec copy -vcodec copy "newfiles\%%~na.mxf" The value (".m2v") represents a set of files to process. In your command there are no files to process since: .m2v is only an extension and ...


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


1

How do I get current logged in user name when running a batch file as administrator It runs fine when the current user has local admin privileges, but for users who aren't I have to enter the domain administrator password for the changes to take place. With the below example you just set a variable with the environmental variables as you already ...


1

Expanding on grawity's great answer: First, to answer your question: Why does the batch script terminate when %CHECKCONTINUE% is given a null value? The problem is, in line 16, you do this: if %CHECKCONTINUE%==n GOTO exit Since CHECKCONTINUE is "undefined", it evaluates to an "empty" string, so the statement on line 16 is actually doing: if ==n GOTO ...



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