Sign in to follow this  
Followers 0
fharen

help Hiding cmd window when using "Run"

7 posts in this topic

hey there guys,. I'm kinda new in Autoit and I'm having a problem on hiding cmd prompt,.

I'm trying to make a personal program that should protect my files a bit,. and put a password on it,.

I got it working,. but I want the cmd prompt not to appear,.

for example

Run(@ComSpec & ' /c ren "<renaming folder>" "<new name>"')

 it just stops working when I make it

Run(@ComSpec & ' /c ren "<renaming folder>" "<new name>"' , @SW_HIDE)

it works fine if I don't try hiding the cmd window that's flashing on the screen

any suggestions?

Share this post


Link to post
Share on other sites



Hi,

Welcome to the autoit forum :)

Have you tried the DirMove or the FileMove function?

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

thanks for the fast reply

well,. if I think about it,. that approach moves files to another folder right? what I want is to rename the folder only,.

I noticed that I was putting the @SW_HIDE in the wrong place ("workingdir") so I made it

Run(@ComSpec & ' /c ren "<renaming folder>" "<new name>"', "", @SW_HIDE)

still not working

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

thanks for the fast reply

well,. if I think about it,. that approach moves files to another folder right?

No, not necessarily :

DirCreate("test")
FileWrite("test\toto.txt", "test")

DirMove("test", "test2")
ShellExecute("test2")
From the helpfile:

Because AutoIt lacks a "DirRename" function, use DirMove to rename a folder!

Br, FireFox. Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

alright,. let's just say that your way works well,.

does that mean it's impossible to hide the cmd if I do my approach?

as I've said,. I already got it to work,. I just need to hide the cmd that's flashing whenever I try to run it,.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Even I don't understand why you want to use the cmd, try this:

Run(@ComSpec & ' /c ren "test" "test2"', @ScriptDir, @SW_HIDE)
Note: Change the working dir (here @ScriptDir) to the folders' directory.

Br, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

the reason is I also want to hide cmd from

Run(@ComSpec & ' /c echo y| CACLS "test1" "/P" "Users:F"')

so rather than using different approach,. I used the same for everything

and nope,. the program doesn't even run when I put @ScriptDir

Scratch that,. it works,. but now the hiding function stopped : p,. anyways,. thanks I think I know what to do now ^_~
 

EDIT: yep,. it's working now. thanks!!

Edited by fharen

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0