Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
How can I make my commands run in NppExec run in cmd, as opposed to the built in console, which doesn't work with things like: "Press any key to continue", which only works when you press enter?
You want to take a look at cmd /? output and http://ss64.com/nt/. Using start along with cmd /c will give an external window and using cmd /k will keep it in the nppexec console. One thing I don't like about the /k option is that it really isn't true as 'any key' doesn't do the trick and Enter needs to be used.
Test it out with cmd /k pause and start cmd /c pause.
Notice the start option has the window close, so any history will go away too. If that's important then substitute /k for the /c and use exit when done.
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
How do I modify the following batch script to kill a process instead of a task?
For example, if BBB.exe once executed runs as a process, how would I kill that process once AAA.exe is closed?
To clarify, if you open task manager, tasks are listed under the "applications" tab and a process is listed under the "processes" tab. The program represented as "BBB.exe" that I'm trying to kill immediately once AAA.exe is closed only opens to the system tray and not the task bar and therefore is not present in the "applications" tab but only the "processes" tab when open. The following batch file does not have any effect on ending program "BBB.exe" even when the machine is ran with admin privileges. I've seen the "Process.Kill()" command but I'm not sure how to properly utilize it.
Thanks in advance.
#Echo off
CD "C:\Users\XXX\XXX\XXX"
start AAA.exe
CD "C:\XXX\XXX"
start BBB.exe
:TEST
Tasklist /FI "IMAGENAME eq AAA.exe" 2>NUL | Find /I /N AAA.exe>NUL
If "%ERRORLEVEL%"=="0" goto ACTIVE
:DEAD
Taskkill /F /IM BBB.exe
Exit
:ACTIVE
Timeout /T 1
Goto TEST
I found out what the problem is.
The issue lies in that the "taskkill" command was never being deployed because command prompt remained in the directory of BBB.exe where the "taskkill" executable doesn't exist.
Simply changing the directoy to either "system32" or "syswow64" (depending on the OS installation) after executing both programs and before running the "taskkill" command in the batch file solved the issue.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to make a .bat file that when opened will copy a folder and all it contains into another folder on another partition. Here is exactly what I am trying to do:
Copy C:\Documents and Settings\user\Desktop\Документи and all it contains to D:\Backup. I have tried with many xcopy commands but without result. Thanks.
I launched the command prompt with /k and saw this
which made me think there is a problem with the font. I installed new font that should fix this (YGP_NT) but I am having the same problem (yes, I changed it from the cmd Properties, edited the TrueTypeFont with regedit and restarted the PC). I can write in cyrillic in the cmd if that can help.
xcopy "%userprofile%\Desktop\Документи" "D:\Backup\" /s/h/e/k/f/c
should work, assuming that your language setting allows Cyrillic (or you use Unicode fonts in the console).
For reference about the arguments: http://ss64.com/nt/xcopy.html
xcopy e:\source_folder f:\destination_folder /e /i /h
The /h is just in case there are hidden files. The /i creates a destination folder if there are muliple source files.
xcopy "C:\Documents and Settings\user\Desktop\Документи" "D:\Backup" /s /e /y /i
Probably the problem is the space.Try with quotes.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I can use the variable %CD% to run a command-line virus scanner to scan the current directory from command prompt like this.
C:\AVPTool\AVPTool.exe SCAN %CD% /R:KAVSCANLOG.txt
I'd like use it from context menu to easily scan the folder with just two clicks.
I modified the registry and created a key called Scan with AVPTool in HKEY_CLASSES_ROOT\Directory\shell and within that key I created another key called command and changed the value to
"cmd.exe /k cd %1 & C:\AVPTool\AVPTool.exe SCAN %CD% /R:KAVSCANLOG.txt"
But this doesn't work since %CD% doesn't get translated into the current working directory.
I'd try
"cmd.exe /k cd %1 & C:\AVPTool\AVPTool.exe SCAN "%1" /R:KAVSCANLOG.txt"
since the line would be processed by replacing the %-variables and THEN executed, %CD% would be replaced by whatever the current directory of the INVOKING process is, not the directory in which the process is RUN. The current directory is only changed AFTER the cd has been executed, and by that time, %CD% has already been installed into the command - as it stood when the cmd.exe was invoked.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Having never used VBScript before, I just want to make sure I'm headed down the right path before I launch into it.
I need to create a process that will run via Windows Scheduler on a weekly basis.
I need the script to do the following:
Call PSFTP.exe and open a SSH session to a SFTP site, download a file and save it in a particular folder.
Unzip the files after download.
Open Truecrypt and mount encrypted volumes.
Activate a few other processes via the cmd line, in order.
All of this needs to be in order and each step needs to wait for the previous step to finish.
Can I achieve this using VBScript or a combination of VBScript and BAT files? Or should I be going down a different route?
Thanks in advance!
GPC
in its simplest form, what you want may be achieved with this short BAT file
::: C:\DEST\SO.BAT :::
pushd c:\dest
echo cd downloads > psftp.scr
echo get file.zip >> psftp.scr
echo quit >> psftp.scr
psftp user#domain.com -pw password -b psftp.scr
7z x -o file.zip
truecrypt /q /v myvolume
and schedule it to run every monday with this command
AT 09:00 /EVERY:MONDAY C:\DEST\SO.BAT
or (thanks, iesou!) in case you need specific user rights, want a task specific name... with
schtasks /create /SC Weekly /MO 1 /D Friday /TN "File Download and Extract" /TR "C:\DEST\SO.BAT" /ST 09:00 /RU PCNAME\USER /RP PASSWORD
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I am trying to use chmod utility on windows command line but it does not work. I am looking for the command to change the files and folder permission on windows.
The following commands will help to take the ownership of the directory and files:
D:\>takeown /f D:\path\to\directory /r /d y
D:\>icacls D:\path\to\directory /grant administrators:F /t