batch-file

How do I create folder from file name and move files into folder?

风格不统一 提交于 2020-01-06 12:41:34
问题 I need a windows batch file to create a folder based on part of a file name (the part before an underscore) and move any files that start with the folder name into the folder. I'm not familiar with windows batch files. I've googled and tinkered a solution which works except that I cannot substring the file name at the underscore. (Yes there are a few similar threads but nothing I could use to exactly answer my question) FWIW my unsuccessful solution: @ECHO OFF setlocal enabledelayedexpansion

How do I create folder from file name and move files into folder?

余生颓废 提交于 2020-01-06 12:38:26
问题 I need a windows batch file to create a folder based on part of a file name (the part before an underscore) and move any files that start with the folder name into the folder. I'm not familiar with windows batch files. I've googled and tinkered a solution which works except that I cannot substring the file name at the underscore. (Yes there are a few similar threads but nothing I could use to exactly answer my question) FWIW my unsuccessful solution: @ECHO OFF setlocal enabledelayedexpansion

I need a way to prompt a user for an input using batch

我是研究僧i 提交于 2020-01-06 12:37:30
问题 I noticed a post on how to make a batch that opens another batch upon an input. However, I need a way that will make the code pause until the correct input is entered, then continue. So for example, the code would ask what is the access code? Then the user would input the correct code, for example 123. Then the code would say "Welcome!" Then it would execute another question like "What do you want to do today?" There would be a list of options: A. Game B. Browse C. Nevermind The user would in

I need a way to prompt a user for an input using batch

筅森魡賤 提交于 2020-01-06 12:37:11
问题 I noticed a post on how to make a batch that opens another batch upon an input. However, I need a way that will make the code pause until the correct input is entered, then continue. So for example, the code would ask what is the access code? Then the user would input the correct code, for example 123. Then the code would say "Welcome!" Then it would execute another question like "What do you want to do today?" There would be a list of options: A. Game B. Browse C. Nevermind The user would in

I need a way to prompt a user for an input using batch

不想你离开。 提交于 2020-01-06 12:37:03
问题 I noticed a post on how to make a batch that opens another batch upon an input. However, I need a way that will make the code pause until the correct input is entered, then continue. So for example, the code would ask what is the access code? Then the user would input the correct code, for example 123. Then the code would say "Welcome!" Then it would execute another question like "What do you want to do today?" There would be a list of options: A. Game B. Browse C. Nevermind The user would in

Batch-file “and if” statement

守給你的承諾、 提交于 2020-01-06 11:36:36
问题 I have no idea at all how to make an "and if" statement for my batch file, and I hope I could get some help in here. The line I'm trying to make: if %a%==X/O and if %b%==X/O goto done 回答1: Batch doesn't have support for and s or or s in if logic. You can simulate an and by nesting your conditions. if %a%==X/O ( if %b%==X/O ( goto done ) ) Similarly, you can simulate an or by having two separate checks. if %a%==X/O goto done if %b%==X/O goto done 来源: https://stackoverflow.com/questions

Batch-file “and if” statement

Deadly 提交于 2020-01-06 11:35:19
问题 I have no idea at all how to make an "and if" statement for my batch file, and I hope I could get some help in here. The line I'm trying to make: if %a%==X/O and if %b%==X/O goto done 回答1: Batch doesn't have support for and s or or s in if logic. You can simulate an and by nesting your conditions. if %a%==X/O ( if %b%==X/O ( goto done ) ) Similarly, you can simulate an or by having two separate checks. if %a%==X/O goto done if %b%==X/O goto done 来源: https://stackoverflow.com/questions

edit the etc\hosts file

人走茶凉 提交于 2020-01-06 09:05:31
问题 Using C or a bat file, I'm trying to edit the file hosts file from c:\Windows\System32\drivers\etc but I can;t bc it is write protected. Can you tell me what can i do? 回答1: The program modifying the host file needs to run as Administrator 回答2: Can you tell me what can i do? Yes. Get the Administrator password or find another way to solve your problem. If you describe what is your problem (rather than your issue on a possible solution) maybe we can figure a different (working) solution. 来源:

Batch Script related issue

一曲冷凌霜 提交于 2020-01-06 08:37:13
问题 I have written following script which works absolutely fine on my system. @echo off setlocal enabledelayedexpansion FOR /F %%i IN ('wmic /node:%1 computersystem get Name') DO SET A=%%i FOR /F %%i IN ('wmic /node:%1 computersystem get Domain') DO SET B=%%i FOR /F %%i IN ('wmic /node:%1 computersystem get UserName') DO SET C=%%i FOR /F %%i IN ('wmic /node:%1 computersystem get Manufacturer') DO SET D=%%i FOR /F "delims=" %%i IN ('wmic /node:%1 computersystem get Model') DO SET E=%%i FOR /F %%i

How to cause button click event when enter is pressed in an hta application

北城以北 提交于 2020-01-06 08:24:12
问题 I have a script that allows me to hide a folder on my pc (using batch file). I've just implemented an hta application to it for the password so It's more seccure. Now the problem I'm having is that if I want to press enter to submit the form on the hta application, it just clears the password field and does nothing. I would like it to have the same effect as if I were to push the OK button. This is the hta part of my batch file: :HTA <html> <head> <title>Password Entry</title> <hta