3 posts in this topic
I need to be able to issue a command line which has a folder in parentheses as
attrib +s +h "absolute folder to hide" I've read through many posts here but nothing quite hacks how to use a variable as the folder in parentheses.
Local $dosattrib = "attrib +s +h " & ""$hidFolder"" ; $hidFolder built up from decrypted encrypted C:\Hidden Folder which I do not want visible when compiled version is reverse engineered which errors with excess parentheses but in single "" it doesn't work.
There seems to be a relatively complicated method to make it work but surely there's a simple way?
Hello Everyone , Are you tired of searching the forum for getting both the exit code & the stdout output? Then you are in the right place!
With this UDF you can get the both output & exit code of the command or the console app! Or you can get the exit code of another process without having to use RunWait...
1. Simple & Lightweight (15 KB)
2. Detailed comments & description
3. Flexible functions with many optional parameters
A BIG THANKS TO PsaltyDS for the functions! 2 of the (main) functions in the UDF are his work
List of functions:
Grab the latest (in development) code from GitHub
Hope it may help you, TD
P.S Icon made by Freepik from www.flaticon.com, Modified by TheDcoder
I need to start a script that include:
- admin privileges
- multiple cmd commands
- no bat, no exe, no tmp files created anywhere (especially in the user temp folder)
In a bat file it would be simple, but users shouldn't see what commands I'm sending.
Example of the script:
echo off cls echo. echo I AM A TOOL echo. echo NOTE: echo - note 1 echo - note 2 echo - etc set USER1=0 set COMPUTER1=0 if /i %username% equ user.user ( set USER1=1 set COMPUTER1=1 ) if /i %username% equ another.user set USER1=1 if /i %computername% equ notebook set COMPUTER1=1 if %USER1% EQU 1 ( if %COMPUTER1% EQU 1 ( reg delete "HKLM\SOFTWARE\blablabla" /f ) else ( echo Computer not authorized. Contact assistance.) ) else ( echo User not authorized. Contact assistance.) echo. pause exit With the send("") is a disaster.
I'm a noob here, so what can I do?
EDIT: OR ELSE I explain the situation and what I need, so if there is a simple solution I can use that.
SITUATION: our domain users have Users rights on the machine. Some of them need administrator rights.
We create a local user with administrator rights, so that the users must insert username and password when asked to run something with administrator rights.
We have an internal domain group policy that blocks EXE, BAT, COM, TMP files from the user local temp directory, for a security reason (malware). That also blocks most software installation.
But some users are often out of office, away from workplace and in another country, they need a complete control on their computers.
WHAT I NEED: I need to check the username and the computer name. If the username is the one with local administrator rights and the computer name is a computer that is qualified to temporary remove the policy, then I need to execute a REG DELETE command with administrator rights.
I hope I explained myself.
Thank you very much.
I need your help again. So I am working on a Project with which I can Logoff a User in a Terminal-Server (Windows Server 2012 R2), logged in as Admin. Then backup the users partition and log him back in. Sounds pretty easy for you guys, right? So my problem is... I seem to not be able to get the User ID. You can see and display the ID in a textfile with:
Run("query user>>c:\users\example\desktop\helpmeguys.txt") This line just writes a textfile of "query user" on the desktop. This is an example on what it looks like:
BENUTZERNAME SITZUNGSNAME ID STATUS LEERLAUF ANMELDEZEIT
>wg console 2 Aktiv 17 25.07.2016 08:19
What I need right now is the ID. Any Idea on how to read it off of the Textfile?
Please give me examples because I am still a rookie!
With kind regards
I wrote a small AutoIt App which takes DOS formatted textfiles and forwards them to MS Word. I searched a lot for a programm which does this, but I didn't find one.
The reason for it is an old DOS program, which is used a lot, even today. The user wanted to print the output of that programm with some other font-size, font-style and so on... We used WinPrint, but this is a printing only app, so no formatting can be done afterwards...
The solution was, to print with the DOS prgramm to an file, e.g. C:\12345\output.txt ... then read this file, convert it to unicode, put this into word with some pre-defined font / page size and so on ... and then the user can re-format or print it now.
Here is the main function of the Dos2Word programm I wrote:
Func Convert2Word() ; keine datei da... If Not FileExists($sFilePath) Then Return ; noch in Beaarbeitung... If _WinAPI_FileInUse($sFilePath) Then Return ; nun aber... Local $sFilePathTemp = $sFilePath & "_" & _WinAPI_CreateGUID() & ".txt" FileMove($sFilePath, $sFilePathTemp, $FC_OVERWRITE) ; open word and create new document Local $oWord = _Word_Create() If @error Then ErrorExit("Fehler bei _Word_Create()") Local $oDoc = _Word_DocAdd($oWord) If @error Then ErrorExit("Fehler bei _Word_DocAdd()") ; seite definieren With $oDoc.PageSetup .PageHeight = $sPageHeight .PageWidth = $sPageWidth .TopMargin = $sTopMargin .BottomMargin = $sBottomMargin .LeftMargin = $sLeftMargin .RightMargin = $sRightMargin EndWith ; schrift und absatz With $oDoc.Range .Font.Name = $sFontName .Font.Size = $sFontSize EndWith With $oDoc.Range.ParagraphFormat .SpaceBefore = 0 .SpaceAfter = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 .LineSpacingRule = 0 EndWith Local $hFile = FileOpen($sFilePathTemp, BitOR($FO_READ, $FO_BINARY)) Local $iError Local $iLine = 1 Do Local $sLine = FileReadLine($hFile, $iLine) $iError = @error $iLine += 1 ; ignore special escape line of cm.exe If StringLeft($sLine, 2) = Chr(27) & Chr(64) Then $sLine = StringTrimLeft($sLine, 2) $oDoc.Range.insertAfter(_WinAPI_MultiByteToWideChar($sLine, $sCodePage, 0, True) & @CRLF) Until $iError <> 0 ; und am ende löschen, sofern gewünscht FileClose($hFile) If $sFilesDelete <> "0" Then FileDelete($sFilePathTemp) EndFunc ;==>Convert2Word The Homepage of the program is here: https://mcmilk.de/projects/Dos2Word/
The full source code and precompild signed binaries for 32bit and 64bit systems are also there, the License is GPLv2
With best regards, Milky
Maybe someone finds it useful too