[Solved]Paste line of text into a command prompt and run it?

You need help to start using UVK? You have a doubt on a UVK feature? Post here!
Forum rules
We have no special rules for UVK forums. Just try to be polite and clear in your posts.
Please don't post spam in this forum. Spammers will be banned by IP, e-mail and username.
We reserve the right to delete all posts and ban all users we consider not having respected these rules without warning.
Post Reply
netmonk99
Posts: 13
Joined: Tue May 29, 2012 6:44 am

[Solved]Paste line of text into a command prompt and run it?

Post by netmonk99 »

Is is possible to use a UVK script to open a command prompt and paste a line of text into it, and then have the script press enter (run)?

Like so...

<UVKCommandsScript>

<RunSfcScan>
<CmdScript>
@echo off
findstr /c:”[SR]” %windir%\Logs\CBS\CBS.log >”%userprofile%\Desktop\sfcdetails.txt”

The above snippet should, of course, run SFC and then the line of text should paste the SFC results onto the desktop for easy finding/reading.

Any assistance would be greatly appreciated!
Fred
Site Admin
Posts: 2360
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: Paste a line of text into a command prompt and run it?

Post by Fred »

Hi netmonk99.

Your code should work fine. However, when I tested it, it didn't work because the double quotes had been modified, probably by copy/paste in the forum.

For instance, the code should be:

Code: Select all

<RunSfcScan>
<CmdScript>
@echo off
findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log >"%userprofile%\Desktop\sfcdetails.txt"
But not:

Code: Select all

<RunSfcScan>
<CmdScript>
@echo off
findstr /c:”[SR]” %windir%\Logs\CBS\CBS.log >”%userprofile%\Desktop\sfcdetails.txt”
Do you see the difference in the double quotes?

Just rewrite them in the script and it should be fine.

To debug the result of the cmd commands you can use <RunWait> and cmd /k. e.g.

Code: Select all

<RunWait>
cmd /k findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log >"%userprofile%\Desktop\sfcdetails.txt"
Hope it helps.
One thing we humans have in common is that we are all different. So, if you think you're weird because you're different from everyone else, then we are all weird.

Fred
netmonk99
Posts: 13
Joined: Tue May 29, 2012 6:44 am

Re: Paste a line of text into a command prompt and run it?

Post by netmonk99 »

Ohh, okay, I see the difference now. Thanks for pointing that out!

And thanks for making such an awesome program!
Post Reply