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 3 years ago.
Improve this question
I am a beginer in dev in new enterprise.
I use Psexec to open a new instance of CMD (with sdial)
I try to write inside but this is not working, look picture and code for to be clear
psexec.exe -d -i -s cmd /c "echo toto & sdial &echo toto"
I want write "toto" like this picture (i have typed with keyboard but i want write "toto" with bat or powershell)
in taskmanager I have sDIal.exe in command line (maybe can help you)
How to write inside cmd window call "sDial" with bat or powershell ?
last edit
#mklement0 rep to my ask sucessfully
Now i try to register in txt but this is not working
psexec.exe -d -i -s cmd /c "echo toto | sdial" >> output.txt
there is not txt file ...
It sounds like you're trying to provide input to an interactive prompt that program sdial presents.
You can try to pipe (|) this input to sdial:
psexec.exe -d -i -s cmd /c "echo toto|sdial"
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 3 years ago.
Improve this question
I want to open CMD file and with in the new CMD windows
like this:
How can I write something in the new cmd window?
I can use BAT or PowerShell.
start cmd.exe /c D: & D:\Aither\Box\SysinternalsSuite\PsExec.exe -d -i -s %windir%\system32\cmd.exe
Assuming you want to execute commands on startup of the new console window (-i) that runs in the System account (-s):
psexec.exe -d -i -s cmd /k "echo hi & date /t"
The above runs echo hi and date /t when the new window opens.
like this
cmd.exe /c "echo hello"
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 6 years ago.
Improve this question
I have a shell script:
#!usr/bin/bash
branch_name=$1
task_name=$2
createviewset ccm -b $branch_name -t $task_name
source setenv $task_name
rest of the code
Now I want to convert this script to a Perl script. How can I do that? So far what I have written in the code but this code does not seem to work.
!/usr/bin/perl
use warnings;
use strict;
my branch_name;
my task_name;
createviewset ccm -b $branch_name -t $task_name
source setenv $task_name
Here the createviewset is an existing script which I am calling here.
You should visit http://perlmaven.com/ (available in many languages) or http://learn.perl.org/ to learn some Perl first.
Your shell script doesn't need to copy the commandline values. You also used #!usr/bin/bash which won't work because the path is either /usr/bin/bash or (more common) /bin/bash:
#!/bin/bash
createviewset ccm -b $1 -t $2
source setenv $2
rest of the code
Perl assigns all command line arguments to the array #ARGV. This sample prints your two arguments:
#!/usr/bin/perl
print $ARGV[0];
print $ARGV[1];
Notice that the numbering starts with 0 instead of 1 as in $1 in your bash script.
Next part is running external (shell) commands in Perl: Use the system command.
#!/usr/bin/perl
use strict;
use warnings;
system 'createviewset','ccm','-b',$ARGV[0],'-t',$ARGV[1];
system 'source','setenv',$ARGV[1];
Notice that the source command won't work because a Perl script is not a shell script and can't "include" Bash script. I appreciate that you're trying to use Perl for your problem, but it looks like Bash is the much better tool for this.
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 8 years ago.
Improve this question
I have a folder that contains some text files. I need to delete the last character of each filename in this folder. filenames are shown below.
1ADFG.txt
RG25A.txt
5SDFC.txt
Desired output
1ADF.txt
RG25.txt
5SDF.txt
I would do like this:
for i in *.txt; do echo "mv '$i' '${i/?.txt}.txt'"; done
If the output looks good, then pipe it to | sh, that is:
for i in *.txt; do echo "mv '$i' '${i/?.txt}.txt'"; done | sh
This
awk 'BEGIN {FS="."} {print substr($1,1,length($1)-1) "." $2;}'
feeded with the list of the names should do the job, provided that there's only 1 dot, the one for the extension.
You could also use sed like this :
$ ls -1
1ADFG.txt
5SDFC.txt
RG25A.txt
$ ls -1|sed "s/\([A-Za-z0-9]\{4\}\)[A-Za-z0-9]*\(\.[A-Za-z0-9]\)/\1\2/g"
1ADF.txt
5SDF.txt
RG25.txt
another way is to use the perl rename utility:
$ rename -n 's/.\./\./' *.txt
1ADFG.txt renamed as 1ADF.txt
5SDFC.txt renamed as 5SDF.txt
RG25A.txt renamed as RG25.txt
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Can anybody say me what does this command mean? Thanks
grep -h -o "\#string\/\(\w*\)" * -R | sed "s!#string\/\(\w*\)!\1!p" | sort | uniq > ..\AndroidProject1\tmp_used_strings.txt
This command will give you the list of string which is used in android layout xml file.
grep -h -o "\#string\/\(\w*\)" * -R
-R - Recursive searching
-h - no file name
-o - print only matched part of string
This command will give you the exact match string. Then, you are piping this output to input of sed command.
sed "s!#string\/\(\w*\)!\1!p"
This command will parse the input and separate the name. Then, sorting the result and store the uniq values to the file.
For more information about options, see the man page of command.
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 7 years ago.
Improve this question
I have two directories containing source files to a project I've inherited with little by way of documentation. How do I compare both directories to make see what the differences are?
Try this:
diff -Naur dir1/ dir2/
The -u option makes the output a
little easier to read.
The -r option recurses through all
subdirectories
The -N and -a options are really
only necessary if you wanted to create
a patch file.
You can try Meld. It is a wonderful visual diff tool ;-)
diff -u -r dirA dirB
Will show you a unified recursive diff between the files in dirA and dirB
You may use the diff command in the shell. Or install a tool like KDiff3.
The diff command to compare directories kept telling me that I didn't have differences, when I knew there were differences.
Instead of using diff directly, I used a sorted list of md5sums and then compared those files with diff:
find /path1/dir/ -type f -exec md5sum {} + | awk '{print $2 $1}' | sort >! path1.log
find /path2/dir/ -type f -exec md5sum {} + | awk '{print $2 $1}' | sort >! path2.log
gvimdiff path1.log path2.log
If the beginning part of the path is causing headaches, then change it. Select the Path1 window and type:
:%s|path1|path2|g
This will replace all instances of path1 with path2 in the first file, and now your diff should only show differences.