cmd

Activating conda environment from c# code (or what is the differences between manually opening cmd and opening it from c#?)

半腔热情 提交于 2020-02-21 23:57:02
问题 I want to run a gpu accelerated python script on windows using conda environment (dlwin36). I’m trying to activate dlwin36 and execute a script: 1) activate dlwin36 2) set KERAS_BACKEND=tensorflow 3) python myscript.py If I manually open cmd on my machine and write:"activate dlwin36" it works. But when I try opening a cmd from c# I get: “activate is not recognized as an internal or external command, operable program or batch file.” I tried using the following methods: Command chaining: var

How to auto-hide the taskbar from the command line

我的未来我决定 提交于 2020-02-21 11:01:51
问题 Does anyone know how I can automatically hide the task bar in windows 7 via command line or some other method? 回答1: Here's a little C program that will toggle the hidden/shown state of the taskbar window. Note that when it's hidden it's actually gone from the screen completely (it's not in auto-hide mode). #include <windows.h> int main() { HWND hwnd = FindWindow("Shell_traywnd", ""); if (IsWindowVisible(hwnd)) SetWindowPos(hwnd,0,0,0,0,0,SWP_HIDEWINDOW); else SetWindowPos(hwnd,0,0,0,0,0,SWP

CMD Script: How to close the CMD

爱⌒轻易说出口 提交于 2020-02-20 08:03:13
问题 I have created a small command that will let me launch Internet Explorer. However, I wish to close the small command prompt that shows up when I launch IE. How can I do this? This is my current code: "%ProgramFiles%\Internet Explorer\iexplore.exe" http://localhost/test.html PAUSE I am guessing if I take out the Pause. It will close the CMD box upon closing IE?? Also is there another command that I can use to simply create a command that will let me add something to the Menu with a small icon,

Using a text file as input to a Powershell script

会有一股神秘感。 提交于 2020-02-14 21:06:47
问题 My group is moving to a new network where we can't directly copy from our computer in Network A to the new machine in Network B. After years on this machine in Network A, I've got project files interspersed all over the disk. I need to build a script to copy the folders and files to a backup disk. No problem there, but the network tech guy requires the total byte count to be known before copying. In CMD I've used dir /AD /S /B > C:\Users\r6540\Desktop\UserFiles.txt from C:\ to generate a huge

Using a text file as input to a Powershell script

落花浮王杯 提交于 2020-02-14 21:06:12
问题 My group is moving to a new network where we can't directly copy from our computer in Network A to the new machine in Network B. After years on this machine in Network A, I've got project files interspersed all over the disk. I need to build a script to copy the folders and files to a backup disk. No problem there, but the network tech guy requires the total byte count to be known before copying. In CMD I've used dir /AD /S /B > C:\Users\r6540\Desktop\UserFiles.txt from C:\ to generate a huge

Using a text file as input to a Powershell script

前提是你 提交于 2020-02-14 21:05:09
问题 My group is moving to a new network where we can't directly copy from our computer in Network A to the new machine in Network B. After years on this machine in Network A, I've got project files interspersed all over the disk. I need to build a script to copy the folders and files to a backup disk. No problem there, but the network tech guy requires the total byte count to be known before copying. In CMD I've used dir /AD /S /B > C:\Users\r6540\Desktop\UserFiles.txt from C:\ to generate a huge

How do I echo and send console output to a file in a bat script?

孤街浪徒 提交于 2020-02-08 21:40:06
问题 I have a batch script that executes a task and sends the output to a text file. Is there a way to have the output show on the console window as well? For Example: c:\Windows>dir > windows-dir.txt Is there a way to have the output of dir display in the console window as well as put it into the text file? 回答1: No, you can't with pure redirection. But with some tricks (like tee.bat) you can. I try to explain the redirection a bit. You redirect one of the ten streams with > file or < file It is

How do I echo and send console output to a file in a bat script?

旧街凉风 提交于 2020-02-08 21:39:05
问题 I have a batch script that executes a task and sends the output to a text file. Is there a way to have the output show on the console window as well? For Example: c:\Windows>dir > windows-dir.txt Is there a way to have the output of dir display in the console window as well as put it into the text file? 回答1: No, you can't with pure redirection. But with some tricks (like tee.bat) you can. I try to explain the redirection a bit. You redirect one of the ten streams with > file or < file It is

Windows cmd simulate console input a command

删除回忆录丶 提交于 2020-02-06 07:56:16
问题 I need to write a batch script which connects to a vpn automatically when username and password is saved somewhere (Ex: in a file). VPN client is openconnect which provides a CLI but the problem is user input needs to be provided interactively to the command in order for it to complete. See the output below when I run : openconnect <serverhostname> OUTPUT POST https://<serverhostname>/ Connected to <serverhostname>:443 SSL negotiation with <serverhostname> Server certificate verify failed:

Code in Command prompt doesn't work in batch file

女生的网名这么多〃 提交于 2020-02-06 04:55:30
问题 The code below does what I want when I execute it in the command prompt but not when I put it in a .bat file and try to execute it: for /f %a in ('dir /b *.csv') do for /f "tokens=*" %b in (%a) do echo %b,%a >> all.csv What am I missing. Also is there a way to have it do exactly what it does without displaying every step in the loop in the command prompt window. Excuse me I am a newbie! 回答1: In batch files - as opposed to at the command prompt - for variables require two %% signs, e.g. %%a .