Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 months ago.
Improve this question
I am trying to replace these special characters using Windows batch scripting.
Existing
To
My "name" is XXXX
My \"name\" is XXXX
My name is XXX\X
My name is XXX\\X
I tried to achieve this through Informatica Cloud. It is not working, so I am trying to create one single code for these scenarios.
Try drag and drop your input file over this batch script using regex in powershell to replace the special char :
#echo off
Title Replace Some Special Char
Set "InputFile=%1"
If [%InputFile%] EQU [] echo/ You should Drag and Drop an Inputfile over this batch script "%~nx0" & TimeOut /T 8 /NoBreak>nul & exit /b 1
Powershell -Command "(gc '%InputFile%' -raw) -replace '([\"\\])', '\$1' ^| Out-File output.txt"
Start "" output.txt
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Is it possible to execute ping.exe file every 2 minutes one by one in a loop.
The BAT file can be like:
programme.exe
--server firstxyzdomain.com --port 4040
RUN IT FOR 2 MINUTES
THEN PAUSE
THEN EXECUTE OTHER COMMAND
--server SECONDxyzdomain.com --port 20595
RUN IT FOR 2MINUTES
THEN PAUSE
LOOPBACK & resume
Yes. Create a list of devices, ping them using the -n option as provided by ping
#echo off
:start
set "myips=localhost,127.0.0.1,google.com"
for %%a in (%myips%) do ping %%~a -n 121
goto :start
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
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.
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