cmd

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

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

Why can't I use 'php artisan' cmd in Laravel path (Win)

半城伤御伤魂 提交于 2021-02-07 08:22:09
问题 I have tried to learn Laravel in Ubuntu and the command "php artisan' worked in the laravel folder path in the terminal. I just start to do it in Win7, I typed "cd c:\wamp\www\myproject" in cmd.exe to change the path to the laravel folder (artisan file is in this folder). After that I tried "php artisan" but I got this message "'php' is not recognized as an internal or external command, operable program or batch file." Did I miss something? The command line showed there is C:\wamp\www

Why can't I use 'php artisan' cmd in Laravel path (Win)

这一生的挚爱 提交于 2021-02-07 08:22:00
问题 I have tried to learn Laravel in Ubuntu and the command "php artisan' worked in the laravel folder path in the terminal. I just start to do it in Win7, I typed "cd c:\wamp\www\myproject" in cmd.exe to change the path to the laravel folder (artisan file is in this folder). After that I tried "php artisan" but I got this message "'php' is not recognized as an internal or external command, operable program or batch file." Did I miss something? The command line showed there is C:\wamp\www

Exit from nested batch file

左心房为你撑大大i 提交于 2021-02-07 06:26:07
问题 I have 4 batch files, suppose a.bat, b.bat, c.bat and d.bat. Now these batch files are called in such a manner that a.bat calls b.bat, b.bat calls c.call and so on. If I get any error in any batch file, I want to exit from the entire program by saying an error occurred, and mention which batch file had a problem. My question is , how can I do this? Here I used exit /b but it only gets out from the current batch file and moves back into batch file from whence it was called: a.bat @echo. off