batch-file

How to run multiple commands in one batch file?

£可爱£侵袭症+ 提交于 2021-02-17 06:15:07
问题 I want to run multiple commands in one batch file. I tried the &, &&, start, /wait, call, :begin and goto begin commands but no luck. Here are my commands: C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f sc config remoteregistry start= auto sc start remoteregistry sc config Schedule start=auto sc start Schedule sc stop McAfeeFramework sc configure McAfeeFramework startup= disabled sc

Use ffprobe to view audio tracks by language [closed]

我只是一个虾纸丫 提交于 2021-02-17 06:07:59
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . Improve this question I wish to use ffprobe to list all audio streams, and show what language is used. Simply this is part of me trying to find ways to automatically remove non-english tracks from video files. I am new to ffprobe, but have had some experience using ffmpeg. Because I

Batch script calling robocopy in Process won't terminate

五迷三道 提交于 2021-02-17 04:41:20
问题 If process.Kill() is called from another thread or even another program, the process never comes out of WaitForExit() if the batch script used robocopy.exe until it is finished as if it wasn't killed. Robocopy.exe is called from the batch script. Every other script or program ends as you'd expect. ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = "batch.bat"; startInfo.UseShellExecute = false; startInfo.CreateNoWindow = true; startInfo.RedirectStandardOutput = true;

Export batch variables to text file

泄露秘密 提交于 2021-02-16 20:49:28
问题 I was recently given the advice to export variables from a batch script to a text file using set $>savefile and returning said variables upon another startup using for /f "delims=" %%a in (savefile) do set %%a In implementation, this is not creating a file with the variables, resulting in error in the script, which closes the batch. To remedy the closing, I created a check to display an error message, but still cannot get the script to export variables into a file. Variables ::Variables set

Export batch variables to text file

雨燕双飞 提交于 2021-02-16 20:49:07
问题 I was recently given the advice to export variables from a batch script to a text file using set $>savefile and returning said variables upon another startup using for /f "delims=" %%a in (savefile) do set %%a In implementation, this is not creating a file with the variables, resulting in error in the script, which closes the batch. To remedy the closing, I created a check to display an error message, but still cannot get the script to export variables into a file. Variables ::Variables set

In a batch file, how do I get a file name from a file path?

百般思念 提交于 2021-02-16 14:36:09
问题 I have a batch file that requires the user to enter a file path. Later on in the file I want to isolate just the filename and extention from the path, ie anything after the last '\'. set FILEPATH=\\srv-01\My Docs\Templates\My SpreadSheet.xls ... set FILENAME=??? What do i need to set FILENAME to in order for it to equal 'My SpreadSheet.xls'? Hopefully this is fairly simple to do. Thanks! 回答1: @echo off set FILEPATH=\\srv-01\My Docs\Templates\My SpreadSheet.xls for /F "delims=" %%A in ("

Execute BATCH script in a programs memory

流过昼夜 提交于 2021-02-16 14:35:34
问题 I am currently faced with a problem, I need to execute a batch script within a programs memory (so it does not have to extract the batch file to a temporary location). I am open to solutions in C# and C++ Any help would be appreciated 回答1: cmd.exe won't run a script from the memory of your process. The options which seem most obvious to me are: Relax the constraint that stops you extracting the script to a temporary file. Compress your script into a single line and use cmd.exe /C to execute

Execute BATCH script in a programs memory

匆匆过客 提交于 2021-02-16 14:35:29
问题 I am currently faced with a problem, I need to execute a batch script within a programs memory (so it does not have to extract the batch file to a temporary location). I am open to solutions in C# and C++ Any help would be appreciated 回答1: cmd.exe won't run a script from the memory of your process. The options which seem most obvious to me are: Relax the constraint that stops you extracting the script to a temporary file. Compress your script into a single line and use cmd.exe /C to execute

Problems checking if string is quoted and adding quotes to string

自作多情 提交于 2021-02-16 05:18:08
问题 I am trying to check if a string is quoted by checking the first and last characters of the string. But my script fails when checking for the quote see output: AND was unexpected at this time. below. Code @echo off set mystring=Non quoted string set myquotedstring=^"My quoted string^" echo mystring: %mystring% echo myquotedstring: %myquotedstring% set result=%mystring:~0,1% echo first character of non quoted string is: %result% set result=%mystring:~-1% echo last character of non quoted

Setting a VS2010 environment variable from a batch file?

给你一囗甜甜゛ 提交于 2021-02-15 07:42:54
问题 I'm using a batch file to define some variables that will be used in my program. I want the batch file to change the environment variable and use it in my code , but it's just now working - the macro is not being changed. to be more specific and clear : I have a program that creates a DLL and sets it's version In the common setting of the project - I created a new macro (Common properties->User macros) : TEST_VER = 5 now I want to add a batch file , that will run in the pre-build command and