batch-file

Add batch file to PATH

为君一笑 提交于 2021-02-07 14:14:20
问题 I'm trying to run a .bat file globally by adding the directory which contains it to PATH. This obviously works for exe files but is there a way to run .bat files this way? 回答1: As @SLaks said in his comment, this will work. Based on the rest of your comments, you need to specify the full file name. If there's program.exe and program.bat , you need to enter program.bat and not just program at the command prompt. When you enter program at a command prompt, the shell will first try to execute

Add batch file to PATH

☆樱花仙子☆ 提交于 2021-02-07 14:04:14
问题 I'm trying to run a .bat file globally by adding the directory which contains it to PATH. This obviously works for exe files but is there a way to run .bat files this way? 回答1: As @SLaks said in his comment, this will work. Based on the rest of your comments, you need to specify the full file name. If there's program.exe and program.bat , you need to enter program.bat and not just program at the command prompt. When you enter program at a command prompt, the shell will first try to execute

Open and close websites in batch

ぐ巨炮叔叔 提交于 2021-02-07 10:52:44
问题 I'm trying to make an batch file that opens a website for 5 seconds, then closes it an then loop the batch, I got not much Succes, does anyone now how to do this, without letting all te cmd pages on screen(so the batch also closes the cmd after running) I hope someone can help me. this is the code i got so far, it works but it doesnt close the cmd.exe (Web is the name of the .bat file) @echo off start "chrome.exe" "http://www.websitehere. co" timeout /t 3 taskkill /IM chrome.exe /F :loop

Open and close websites in batch

亡梦爱人 提交于 2021-02-07 10:52:12
问题 I'm trying to make an batch file that opens a website for 5 seconds, then closes it an then loop the batch, I got not much Succes, does anyone now how to do this, without letting all te cmd pages on screen(so the batch also closes the cmd after running) I hope someone can help me. this is the code i got so far, it works but it doesnt close the cmd.exe (Web is the name of the .bat file) @echo off start "chrome.exe" "http://www.websitehere. co" timeout /t 3 taskkill /IM chrome.exe /F :loop

How to get drive letter of mapped network drive

a 夏天 提交于 2021-02-07 10:41:51
问题 I need to create a script or batch file to run on multiple computers that unmaps a network share \\serverName\shareName and maps a new network share \\newServer\newShareName I can unmap the network drives by using: net use /delete X: and map the new share with: net use * \\newServer\newShareName but the problem is the drive letter is going to be different on every computer. How would I check what letter \\serverName\shareName is mapped to? 回答1: for /f "tokens=2,3" %%i in ('net use') do if '%

How to get drive letter of mapped network drive

这一生的挚爱 提交于 2021-02-07 10:41:25
问题 I need to create a script or batch file to run on multiple computers that unmaps a network share \\serverName\shareName and maps a new network share \\newServer\newShareName I can unmap the network drives by using: net use /delete X: and map the new share with: net use * \\newServer\newShareName but the problem is the drive letter is going to be different on every computer. How would I check what letter \\serverName\shareName is mapped to? 回答1: for /f "tokens=2,3" %%i in ('net use') do if '%

Not knowing the destination of USB in CMD

眉间皱痕 提交于 2021-02-07 10:24:25
问题 I am trying to copy files from my USB drive to my PC automatically by using a batch file (.bat) I know I can do something like that xcopy "C:\xxxx\xxxx\xxxx.xxx" "C:\xxxx\xxx\xxxx\xxx.exe" /E /H /I But I faced a little problem... What if I don't know the exact letter of the drive, where the USB is inserted? How am I able to copy those files automatically? If this is possible, can someone please post a simple "xcopy" command from USB to PC. Thanks! 回答1: Can you add a generic file to the root

Not knowing the destination of USB in CMD

守給你的承諾、 提交于 2021-02-07 10:23:59
问题 I am trying to copy files from my USB drive to my PC automatically by using a batch file (.bat) I know I can do something like that xcopy "C:\xxxx\xxxx\xxxx.xxx" "C:\xxxx\xxx\xxxx\xxx.exe" /E /H /I But I faced a little problem... What if I don't know the exact letter of the drive, where the USB is inserted? How am I able to copy those files automatically? If this is possible, can someone please post a simple "xcopy" command from USB to PC. Thanks! 回答1: Can you add a generic file to the root

Not knowing the destination of USB in CMD

你说的曾经没有我的故事 提交于 2021-02-07 10:23:32
问题 I am trying to copy files from my USB drive to my PC automatically by using a batch file (.bat) I know I can do something like that xcopy "C:\xxxx\xxxx\xxxx.xxx" "C:\xxxx\xxx\xxxx\xxx.exe" /E /H /I But I faced a little problem... What if I don't know the exact letter of the drive, where the USB is inserted? How am I able to copy those files automatically? If this is possible, can someone please post a simple "xcopy" command from USB to PC. Thanks! 回答1: Can you add a generic file to the root

Batch file to maximize current window

烂漫一生 提交于 2021-02-07 07:47:18
问题 I built a batch program that I am currently tweaking to make it more readable/user friendly. I would like my .bat file to automatically be set to maximize in the .bat file itself. I read about START /MAX online, but that just opens a new instance of a command prompt window. I don't want to have two .bat files just to maximize one. I know the windows keys to maximize is ALT + SPACE then X . I got the idea maybe I could use some kind of SendKeys in batch scripting to automate that? I didn't