Hack Forums
[.NET] Stupid Question - Running CMD Prompt Commands - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Stupid Question - Running CMD Prompt Commands (/showthread.php?tid=5467667)



Stupid Question - Running CMD Prompt Commands - Flu0z - Nov 18, 2016

Hello,

How do you achieve this

for example

Copy *.csv combined.csv at a click of a button

so it comes all .csv files that are in the same folder as the exe?

Sorry about the stupid question haven't used VB in like 2 years

This is Visual Studio .net btw


* - Malicious Intent - Nov 18, 2016

Not sure if i understand. Also its a wrong part of the forum i think.

Save it as a bat file and run it from within a folder with your csv files.
Code
Copy *.csv combined.csv

Note it will create new tabs in your csv file and not append the files to the end of the document.


* - Flu0z - Nov 18, 2016

(Nov 18, 2016 01:51 PM)michypc Wrote:  Not sure if i understand. Also its a wrong part of the forum i think.

Save it as a bat file and run it from within a folder with your csv files.
Code
Copy *.csv combined.csv

Note it will create new tabs in your csv file and not append the files to the end of the document.

that command in command prompt works

for example file 1

1,4,5
5,7,2
3,7,4

file 2

1,8,7
5,7,4
3,3,2

becomes combined.csv like

1,4,5
5,7,2
3,7,4
1,8,7
5,7,4
3,3,2

I'm probably going to do what you mentioned but put in a sub folder


* - Malicious Intent - Nov 18, 2016

(Nov 18, 2016 02:22 PM)StealthStreams Wrote:  that command in command prompt works

for example file 1

1,4,5
5,7,2
3,7,4

file 2

1,8,7
5,7,4
3,3,2

becomes combined.csv like

1,4,5
5,7,2
3,7,4
1,8,7
5,7,4
3,3,2

I'm probably going to do what you mentioned but put in a sub folder

yep you will have to specify the path so you can also add
Code
mkdir NameOfYourSubFolder
to the beginning of the previous part to create subfolder.


* - xHeaven - Nov 18, 2016

(Nov 18, 2016 02:30 PM)michypc Wrote:  yep you will have to specify the path so you can also add
Code
mkdir NameOfYourSubFolder
to the beginning of the previous part to create subfolder.

What the fuck are you talking about?

OP maybe you need this:
PHP Code

<?php 
Shared Sub cmd
(cmdCommand As String, cmdArguments As String)
        
Dim newProcess As Process = New Process()
        
Dim newProcessInfo As ProcessStartInfo = New ProcessStartInfo()
        
newProcessInfo.Arguments = "/C " + cmdCommand + " " + cmdArguments
        newProcessInfo
.FileName = "cmd.exe"
        
newProcessInfo.WindowStyle = ProcessWindowStyle.Hidden
        newProcess
.StartInfo = newProcessInfo
        newProcess
.Start()
    
End Sub 

HowToUse:
PHP Code

<?php 
cmd
("copy", "*csv combined.csv") 



* - Malicious Intent - Nov 18, 2016

(Nov 18, 2016 03:02 PM)xHeaven Wrote:  What the fuck are you talking about?

OP maybe you need this:
PHP Code

<?php 
Shared Sub cmd
(cmdCommand As String, cmdArguments As String)
        
Dim newProcess As Process = New Process()
        
Dim newProcessInfo As ProcessStartInfo = New ProcessStartInfo()
        
newProcessInfo.Arguments = "/C " + cmdCommand + " " + cmdArguments
        newProcessInfo
.FileName = "cmd.exe"
        
newProcessInfo.WindowStyle = ProcessWindowStyle.Hidden
        newProcess
.StartInfo = newProcessInfo
        newProcess
.Start()
    
End Sub 

HowToUse:
PHP Code

<?php 
cmd
("copy", "*csv combined.csv") 

Yeah that makes sense.. write a bible for something that requires one line.. way to go. I never understood that.


* - Flu0z - Nov 18, 2016

(Nov 18, 2016 03:02 PM)xHeaven Wrote:  What the fuck are you talking about?

OP maybe you need this:
PHP Code

<?php 
Shared Sub cmd
(cmdCommand As String, cmdArguments As String)
        
Dim newProcess As Process = New Process()
        
Dim newProcessInfo As ProcessStartInfo = New ProcessStartInfo()
        
newProcessInfo.Arguments = "/C " + cmdCommand + " " + cmdArguments
        newProcessInfo
.FileName = "cmd.exe"
        
newProcessInfo.WindowStyle = ProcessWindowStyle.Hidden
        newProcess
.StartInfo = newProcessInfo
        newProcess
.Start()
    
End Sub 

HowToUse:
PHP Code

<?php 
cmd
("copy", "*csv combined.csv") 

That's more like it

Thank you to the other guy for trying to help

but also thank you alot for this :)


* - Malicious Intent - Nov 18, 2016

I'm sorry OP I misunderstood your question. I thought you just wanted the quickest solution and that it didn't have to be VB.